"dynamic",
"static")
-#define virDomainReportError(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
- __FUNCTION__, __LINE__, fmt)
+#define virDomainReportError(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \
+ __FUNCTION__, __LINE__, fmt)
#ifndef PROXY
return dom->refs;
}
-static virDomainObjPtr virDomainObjNew(virConnectPtr conn,
- virCapsPtr caps)
+static virDomainObjPtr virDomainObjNew(virCapsPtr caps)
{
virDomainObjPtr domain;
domain->privateDataFreeFunc = caps->privateDataFreeFunc;
if (virMutexInit(&domain->lock) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialize mutex"));
if (domain->privateDataFreeFunc)
(domain->privateDataFreeFunc)(domain->privateData);
return domain;
}
-virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
- virCapsPtr caps,
+virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
virDomainObjListPtr doms,
const virDomainDefPtr def)
{
return domain;
}
- if (!(domain = virDomainObjNew(conn, caps)))
+ if (!(domain = virDomainObjNew(caps)))
return NULL;
domain->def = def;
int flags)
{
if (!info) {
- virDomainReportError(NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing device information"));
return -1;
}
break;
default:
- virDomainReportError(NULL, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown address type '%d'"), info->type);
return -1;
}
static int
-virDomainDevicePCIAddressParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainDevicePCIAddressParseXML(xmlNodePtr node,
virDomainDevicePCIAddressPtr addr)
{
char *domain, *slot, *bus, *function;
if (domain &&
virStrToLong_ui(domain, NULL, 16, &addr->domain) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'domain' attribute"));
goto cleanup;
}
if (bus &&
virStrToLong_ui(bus, NULL, 16, &addr->bus) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'bus' attribute"));
goto cleanup;
}
if (slot &&
virStrToLong_ui(slot, NULL, 16, &addr->slot) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'slot' attribute"));
goto cleanup;
}
if (function &&
virStrToLong_ui(function, NULL, 16, &addr->function) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'function' attribute"));
goto cleanup;
}
if (!virDomainDevicePCIAddressIsValid(addr)) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Insufficient specification for PCI address"));
goto cleanup;
}
static int
-virDomainDeviceDriveAddressParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
virDomainDeviceDriveAddressPtr addr)
{
char *bus, *unit, *controller;
if (controller &&
virStrToLong_ui(controller, NULL, 10, &addr->controller) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'controller' attribute"));
goto cleanup;
}
if (bus &&
virStrToLong_ui(bus, NULL, 10, &addr->bus) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'bus' attribute"));
goto cleanup;
}
if (unit &&
virStrToLong_ui(unit, NULL, 10, &addr->unit) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'unit' attribute"));
goto cleanup;
}
if (!virDomainDeviceDriveAddressIsValid(addr)) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Insufficient specification for drive address"));
goto cleanup;
}
* @param node XML nodeset to parse for device address definition
*/
static int
-virDomainDeviceInfoParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainDeviceInfoParseXML(xmlNodePtr node,
virDomainDeviceInfoPtr info,
int flags)
{
if (type) {
if ((info->type = virDomainDeviceAddressTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown address type '%s'"), type);
goto cleanup;
}
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("No type specified for device address"));
goto cleanup;
}
switch (info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
- if (virDomainDevicePCIAddressParseXML(conn, address, &info->addr.pci) < 0)
+ if (virDomainDevicePCIAddressParseXML(address, &info->addr.pci) < 0)
goto cleanup;
break;
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
- if (virDomainDeviceDriveAddressParseXML(conn, address, &info->addr.drive) < 0)
+ if (virDomainDeviceDriveAddressParseXML(address, &info->addr.drive) < 0)
goto cleanup;
break;
default:
/* Should not happen */
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Unknown device address type"));
goto cleanup;
}
* @param node XML nodeset to parse for disk definition
*/
static virDomainDiskDefPtr
-virDomainDiskDefParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainDiskDefParseXML(xmlNodePtr node,
int flags) {
virDomainDiskDefPtr def;
xmlNodePtr cur;
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainDiskTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown disk type '%s'"), type);
goto error;
}
source = virXMLPropString(cur, "dir");
break;
default:
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %s"),
virDomainDiskTypeToString(def->type));
goto error;
devaddr = virXMLPropString(cur, "devaddr");
} else if (encryption == NULL &&
xmlStrEqual(cur->name, BAD_CAST "encryption")) {
- encryption = virStorageEncryptionParseNode(conn, node->doc,
+ encryption = virStorageEncryptionParseNode(NULL, node->doc,
cur);
if (encryption == NULL)
goto error;
device = virXMLPropString(node, "device");
if (device) {
if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown disk device '%s'"), device);
goto error;
}
if (source == NULL &&
def->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
- virDomainReportError(conn, VIR_ERR_NO_SOURCE,
+ virDomainReportError(VIR_ERR_NO_SOURCE,
target ? "%s" : NULL, target);
goto error;
}
if (target == NULL) {
- virDomainReportError(conn, VIR_ERR_NO_TARGET,
+ virDomainReportError(VIR_ERR_NO_TARGET,
source ? "%s" : NULL, source);
goto error;
}
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
!STRPREFIX(target, "fd")) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid floppy device name: %s"), target);
goto error;
}
!STRPREFIX((const char *)target, "vd") &&
!STRPREFIX((const char *)target, "xvd") &&
!STRPREFIX((const char *)target, "ubd")) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid harddisk device name: %s"), target);
goto error;
}
if (bus) {
if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown disk bus type '%s'"), bus);
goto error;
}
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid bus type '%s' for floppy disk"), bus);
goto error;
}
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
def->bus == VIR_DOMAIN_DISK_BUS_FDC) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid bus type '%s' for disk"), bus);
goto error;
}
if (cachetag &&
(def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown disk cache mode '%s'"), cachetag);
goto error;
}
&def->info.addr.pci.domain,
&def->info.addr.pci.bus,
&def->info.addr.pci.slot) < 3) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse devaddr parameter '%s'"),
devaddr);
goto error;
}
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else {
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
}
* @param node XML nodeset to parse for controller definition
*/
static virDomainControllerDefPtr
-virDomainControllerDefParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainControllerDefParseXML(xmlNodePtr node,
int flags)
{
virDomainControllerDefPtr def;
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainDiskBusTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown disk controller type '%s'"), type);
goto error;
}
idx = virXMLPropString(node, "index");
if (idx) {
if (virStrToLong_i(idx, NULL, 10, &def->idx) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse disk controller index %s"), idx);
goto error;
}
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Disk controllers must use the 'pci' address type"));
goto error;
}
* @param node XML nodeset to parse for disk definition
*/
static virDomainFSDefPtr
-virDomainFSDefParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainFSDefParseXML(xmlNodePtr node,
int flags) {
virDomainFSDefPtr def;
xmlNodePtr cur;
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainFSTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown filesystem type '%s'"), type);
goto error;
}
}
if (source == NULL) {
- virDomainReportError(conn, VIR_ERR_NO_SOURCE,
+ virDomainReportError(VIR_ERR_NO_SOURCE,
target ? "%s" : NULL, target);
goto error;
}
if (target == NULL) {
- virDomainReportError(conn, VIR_ERR_NO_TARGET,
+ virDomainReportError(VIR_ERR_NO_TARGET,
source ? "%s" : NULL, source);
goto error;
}
def->dst = target;
target = NULL;
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
cleanup:
* @return 0 on success, -1 on failure
*/
static virDomainNetDefPtr
-virDomainNetDefParseXML(virConnectPtr conn,
- virCapsPtr caps,
+virDomainNetDefParseXML(virCapsPtr caps,
xmlNodePtr node,
int flags ATTRIBUTE_UNUSED) {
virDomainNetDefPtr def;
type = virXMLPropString(node, "type");
if (type != NULL) {
if ((def->type = virDomainNetTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown interface type '%s'"), type);
goto error;
}
if (macaddr) {
if (virParseMacAddr((const char *)macaddr, def->mac) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to parse mac address '%s'"),
(const char *)macaddr);
goto error;
&def->info.addr.pci.domain,
&def->info.addr.pci.bus,
&def->info.addr.pci.slot) < 3) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse devaddr parameter '%s'"),
devaddr);
goto error;
}
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else {
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
}
* them we should make sure address type is correct */
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Network interfaces must use 'pci' address type"));
goto error;
}
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (network == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No <source> 'network' attribute specified with <interface type='network'/>"));
goto error;
}
case VIR_DOMAIN_NET_TYPE_BRIDGE:
if (bridge == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No <source> 'bridge' attribute specified with <interface type='bridge'/>"));
goto error;
}
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_MCAST:
if (port == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No <source> 'port' attribute specified with socket interface"));
goto error;
}
if (virStrToLong_i(port, NULL, 10, &def->data.socket.port) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <source> 'port' attribute with socket interface"));
goto error;
}
if (address == NULL) {
if (def->type == VIR_DOMAIN_NET_TYPE_CLIENT ||
def->type == VIR_DOMAIN_NET_TYPE_MCAST) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No <source> 'address' attribute specified with socket interface"));
goto error;
}
case VIR_DOMAIN_NET_TYPE_INTERNAL:
if (internal == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("No <source> 'name' attribute specified with <interface type='internal'/>"));
goto error;
}
for (i = 0 ; i < strlen(model) ; i++) {
int char_ok = c_isalnum(model[i]) || model[i] == '_';
if (!char_ok) {
- virDomainReportError (conn, VIR_ERR_INVALID_ARG, "%s",
- _("Model name contains invalid characters"));
+ virDomainReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Model name contains invalid characters"));
goto error;
}
}
*
*/
static virDomainChrDefPtr
-virDomainChrDefParseXML(virConnectPtr conn,
- xmlNodePtr node,
+virDomainChrDefParseXML(xmlNodePtr node,
int flags) {
xmlNodePtr cur;
char *type = NULL;
if ((def->targetType = virDomainChrTargetTypeFromString(nodeName)) < 0) {
/* channel is handled below */
if (STRNEQ(nodeName, "channel")) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("unknown target type for character device: %s"),
nodeName);
VIR_FREE(def);
if (bindService == NULL)
bindService = virXMLPropString(cur, "service");
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown source mode '%s'"),
mode);
goto error;
if (def->targetType == VIR_DOMAIN_CHR_TARGET_TYPE_NULL) {
targetType = virXMLPropString(cur, "type");
if (targetType == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR, "%s",
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
_("character device target does "
"not define a type"));
goto error;
if ((def->targetType =
virDomainChrTargetTypeFromString(targetType)) < 0)
{
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("unknown target type for "
"character device: %s"),
targetType);
}
if (virStrToLong_ui(portStr, NULL, 10, &port) < 0) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("Invalid port number: %s"),
portStr);
goto error;
portStr = virXMLPropString(cur, "port");
if (addrStr == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR, "%s",
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
_("guestfwd channel does not "
"define a target address"));
goto error;
}
if (virSocketParseAddr(addrStr, def->target.addr, 0) < 0)
{
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("%s is not a valid address"),
addrStr);
goto error;
}
if (def->target.addr->stor.ss_family != AF_INET) {
- virDomainReportError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("guestfwd channel only supports "
"IPv4 addresses"));
goto error;
}
if (portStr == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR, "%s",
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
_("guestfwd channel does "
"not define a target port"));
goto error;
}
if (virStrToLong_ui(portStr, NULL, 10, &port) < 0) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("Invalid port number: %s"),
portStr);
goto error;
break;
default:
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
_("unexpected target type type %u"),
def->targetType);
}
case VIR_DOMAIN_CHR_TYPE_PIPE:
if (path == NULL &&
def->type != VIR_DOMAIN_CHR_TYPE_PTY) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source path attribute for char device"));
goto error;
}
if (mode == NULL ||
STREQ(mode, "connect")) {
if (connectHost == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source host attribute for char device"));
goto error;
}
if (connectService == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source service attribute for char device"));
goto error;
}
def->data.tcp.listen = 0;
} else {
if (bindHost == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source host attribute for char device"));
goto error;
}
if (bindService == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source service attribute for char device"));
goto error;
}
else if (STREQ(protocol, "telnet"))
def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown protocol '%s'"), protocol);
goto error;
}
case VIR_DOMAIN_CHR_TYPE_UDP:
if (connectService == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source service attribute for char device"));
goto error;
}
case VIR_DOMAIN_CHR_TYPE_UNIX:
if (path == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source path attribute for char device"));
goto error;
}
break;
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
cleanup:
/* Parse the XML definition for a network interface */
static virDomainInputDefPtr
-virDomainInputDefParseXML(virConnectPtr conn,
- const char *ostype,
+virDomainInputDefParseXML(const char *ostype,
xmlNodePtr node,
int flags) {
virDomainInputDefPtr def;
bus = virXMLPropString(node, "bus");
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing input device type"));
goto error;
}
if ((def->type = virDomainInputTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown input device type '%s'"), type);
goto error;
}
if (bus) {
if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown input bus type '%s'"), bus);
goto error;
}
if (STREQ(ostype, "hvm")) {
if (def->bus == VIR_DOMAIN_INPUT_BUS_PS2 && /* Only allow mouse for ps2 */
def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("ps2 bus does not support %s input device"),
type);
goto error;
}
if (def->bus == VIR_DOMAIN_INPUT_BUS_XEN) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported input bus %s"),
bus);
goto error;
}
} else {
if (def->bus != VIR_DOMAIN_INPUT_BUS_XEN) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported input bus %s"),
bus);
}
if (def->type != VIR_DOMAIN_INPUT_TYPE_MOUSE) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("xen bus does not support %s input device"),
type);
goto error;
}
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
cleanup:
/* Parse the XML definition for a graphics device */
static virDomainGraphicsDefPtr
-virDomainGraphicsDefParseXML(virConnectPtr conn,
- xmlNodePtr node, int flags) {
+virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
virDomainGraphicsDefPtr def;
char *type = NULL;
type = virXMLPropString(node, "type");
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing graphics device type"));
goto error;
}
if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown graphics device type '%s'"), type);
goto error;
}
if (port) {
if (virStrToLong_i(port, NULL, 10, &def->data.vnc.port) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse vnc port %s"), port);
VIR_FREE(port);
goto error;
} else if (STREQ(fullscreen, "no")) {
def->data.sdl.fullscreen = 0;
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown fullscreen value '%s'"), fullscreen);
VIR_FREE(fullscreen);
goto error;
if (port) {
if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse rdp port %s"), port);
VIR_FREE(port);
goto error;
} else if (STREQ(fullscreen, "no")) {
def->data.desktop.fullscreen = 0;
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown fullscreen value '%s'"), fullscreen);
VIR_FREE(fullscreen);
goto error;
static virDomainSoundDefPtr
-virDomainSoundDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainSoundDefParseXML(const xmlNodePtr node,
int flags)
{
char *model;
model = virXMLPropString(node, "model");
if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown sound model '%s'"), model);
goto error;
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
cleanup:
static virDomainWatchdogDefPtr
-virDomainWatchdogDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainWatchdogDefParseXML(const xmlNodePtr node,
int flags)
{
model = virXMLPropString (node, "model");
if (model == NULL) {
- virDomainReportError (conn, VIR_ERR_INTERNAL_ERROR, "%s",
- _("watchdog must contain model name"));
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("watchdog must contain model name"));
goto error;
}
def->model = virDomainWatchdogModelTypeFromString (model);
if (def->model < 0) {
- virDomainReportError (conn, VIR_ERR_INTERNAL_ERROR,
- _("unknown watchdog model '%s'"), model);
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown watchdog model '%s'"), model);
goto error;
}
else {
def->action = virDomainWatchdogActionTypeFromString (action);
if (def->action < 0) {
- virDomainReportError (conn, VIR_ERR_INTERNAL_ERROR,
- _("unknown watchdog action '%s'"), action);
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown watchdog action '%s'"), action);
goto error;
}
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
cleanup:
}
static virDomainVideoDefPtr
-virDomainVideoDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainVideoDefParseXML(const xmlNodePtr node,
virDomainDefPtr dom,
int flags) {
virDomainVideoDefPtr def;
if (type) {
if ((def->type = virDomainVideoTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown video model '%s'"), type);
goto error;
}
} else {
if ((def->type = virDomainVideoDefaultType(dom)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing video model and cannot determine default"));
goto error;
}
if (vram) {
if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse video ram '%s'"), vram);
goto error;
}
if (heads) {
if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse video heads '%s'"), heads);
goto error;
}
def->heads = 1;
}
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
VIR_FREE(type);
}
static int
-virDomainHostdevSubsysUsbDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainHostdevSubsysUsbDefParseXML(const xmlNodePtr node,
virDomainHostdevDefPtr def,
int flags ATTRIBUTE_UNUSED) {
got_vendor = 1;
if (virStrToLong_ui(vendor, NULL, 0,
&def->source.subsys.u.usb.vendor) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse vendor id %s"), vendor);
VIR_FREE(vendor);
goto out;
}
VIR_FREE(vendor);
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("usb vendor needs id"));
goto out;
}
got_product = 1;
if (virStrToLong_ui(product, NULL, 0,
&def->source.subsys.u.usb.product) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse product %s"),
product);
VIR_FREE(product);
}
VIR_FREE(product);
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("usb product needs id"));
goto out;
}
if (bus) {
if (virStrToLong_ui(bus, NULL, 0,
&def->source.subsys.u.usb.bus) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse bus %s"), bus);
VIR_FREE(bus);
goto out;
}
VIR_FREE(bus);
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("usb address needs bus id"));
goto out;
}
if (device) {
if (virStrToLong_ui(device, NULL, 0,
&def->source.subsys.u.usb.device) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse device %s"),
device);
VIR_FREE(device);
}
VIR_FREE(device);
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("usb address needs device id"));
goto out;
}
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown usb source type '%s'"),
cur->name);
goto out;
}
if (got_vendor && def->source.subsys.u.usb.vendor == 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("vendor cannot be 0."));
goto out;
}
if (!got_vendor && got_product) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing vendor"));
goto out;
}
if (got_vendor && !got_product) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing product"));
goto out;
}
static int
-virDomainHostdevSubsysPciDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node,
virDomainHostdevDefPtr def,
int flags) {
virDomainDevicePCIAddressPtr addr =
&def->source.subsys.u.pci;
- if (virDomainDevicePCIAddressParseXML(conn, cur, addr) < 0)
+ if (virDomainDevicePCIAddressParseXML(cur, addr) < 0)
goto out;
} else if ((flags & VIR_DOMAIN_XML_INTERNAL_STATUS) &&
xmlStrEqual(cur->name, BAD_CAST "state")) {
&def->info.addr.pci.domain,
&def->info.addr.pci.bus,
&def->info.addr.pci.slot) < 3) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to parse devaddr parameter '%s'"),
devaddr);
VIR_FREE(devaddr);
}
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown pci source type '%s'"),
cur->name);
goto out;
static virDomainHostdevDefPtr
-virDomainHostdevDefParseXML(virConnectPtr conn,
- const xmlNodePtr node,
+virDomainHostdevDefParseXML(const xmlNodePtr node,
int flags) {
xmlNodePtr cur;
mode = virXMLPropString(node, "mode");
if (mode) {
if ((def->mode=virDomainHostdevModeTypeFromString(mode)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown hostdev mode '%s'"), mode);
goto error;
}
type = virXMLPropString(node, "type");
if (type) {
if ((def->source.subsys.type = virDomainHostdevSubsysTypeFromString(type)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown host device type '%s'"), type);
goto error;
}
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing type in hostdev"));
goto error;
}
if (xmlStrEqual(cur->name, BAD_CAST "source")) {
if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
- if (virDomainHostdevSubsysUsbDefParseXML(conn, cur,
- def, flags) < 0)
+ if (virDomainHostdevSubsysUsbDefParseXML(cur, def, flags) < 0)
goto error;
}
if (def->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- if (virDomainHostdevSubsysPciDefParseXML(conn, cur, def, flags) < 0)
+ if (virDomainHostdevSubsysPciDefParseXML(cur, def, flags) < 0)
goto error;
}
} else if (xmlStrEqual(cur->name, BAD_CAST "address")) {
} else {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown node %s"), cur->name);
}
}
}
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
- if (virDomainDeviceInfoParseXML(conn, node, &def->info, flags) < 0)
+ if (virDomainDeviceInfoParseXML(node, &def->info, flags) < 0)
goto error;
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("PCI host devices must use 'pci' address type"));
goto error;
}
}
-static int virDomainLifecycleParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+static int virDomainLifecycleParseXML(xmlXPathContextPtr ctxt,
const char *xpath,
int *val,
int defaultVal)
} else {
*val = virDomainLifecycleTypeFromString(tmp);
if (*val < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle action %s"), tmp);
VIR_FREE(tmp);
return -1;
}
static int
-virSecurityLabelDefParseXML(virConnectPtr conn,
- const virDomainDefPtr def,
+virSecurityLabelDefParseXML(const virDomainDefPtr def,
xmlXPathContextPtr ctxt,
int flags)
{
p = virXPathStringLimit("string(./seclabel/@type)",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("missing security type"));
goto error;
}
def->seclabel.type = virDomainSeclabelTypeFromString(p);
VIR_FREE(p);
if (def->seclabel.type < 0) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("invalid security type"));
goto error;
}
p = virXPathStringLimit("string(./seclabel/@model)",
VIR_SECURITY_MODEL_BUFLEN-1, ctxt);
if (p == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("missing security model"));
goto error;
}
p = virXPathStringLimit("string(./seclabel/label[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("security label is missing"));
goto error;
}
p = virXPathStringLimit("string(./seclabel/imagelabel[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("security imagelabel is missing"));
goto error;
}
return -1;
}
-virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
const virDomainDefPtr def,
const char *xmlStr,
int flags)
if (!(xml = xmlReadDoc(BAD_CAST xmlStr, "device.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR, NULL);
+ virDomainReportError(VIR_ERR_XML_ERROR, NULL);
goto error;
}
node = xmlDocGetRootElement(xml);
if (node == NULL) {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("missing root element"));
goto error;
}
if (xmlStrEqual(node->name, BAD_CAST "disk")) {
dev->type = VIR_DOMAIN_DEVICE_DISK;
- if (!(dev->data.disk = virDomainDiskDefParseXML(conn, node, flags)))
+ if (!(dev->data.disk = virDomainDiskDefParseXML(node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "filesystem")) {
dev->type = VIR_DOMAIN_DEVICE_FS;
- if (!(dev->data.fs = virDomainFSDefParseXML(conn, node, flags)))
+ if (!(dev->data.fs = virDomainFSDefParseXML(node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "interface")) {
dev->type = VIR_DOMAIN_DEVICE_NET;
- if (!(dev->data.net = virDomainNetDefParseXML(conn, caps, node, flags)))
+ if (!(dev->data.net = virDomainNetDefParseXML(caps, node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "input")) {
dev->type = VIR_DOMAIN_DEVICE_INPUT;
- if (!(dev->data.input = virDomainInputDefParseXML(conn, def->os.type,
+ if (!(dev->data.input = virDomainInputDefParseXML(def->os.type,
node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "sound")) {
dev->type = VIR_DOMAIN_DEVICE_SOUND;
- if (!(dev->data.sound = virDomainSoundDefParseXML(conn, node, flags)))
+ if (!(dev->data.sound = virDomainSoundDefParseXML(node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "watchdog")) {
dev->type = VIR_DOMAIN_DEVICE_WATCHDOG;
- if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(conn, node, flags)))
+ if (!(dev->data.watchdog = virDomainWatchdogDefParseXML(node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "video")) {
dev->type = VIR_DOMAIN_DEVICE_VIDEO;
- if (!(dev->data.video = virDomainVideoDefParseXML(conn, node, def, flags)))
+ if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "hostdev")) {
dev->type = VIR_DOMAIN_DEVICE_HOSTDEV;
- if (!(dev->data.hostdev = virDomainHostdevDefParseXML(conn, node, flags)))
+ if (!(dev->data.hostdev = virDomainHostdevDefParseXML(node, flags)))
goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "controller")) {
dev->type = VIR_DOMAIN_DEVICE_CONTROLLER;
- if (!(dev->data.controller = virDomainControllerDefParseXML(conn, node, flags)))
+ if (!(dev->data.controller = virDomainControllerDefParseXML(node, flags)))
goto error;
} else {
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("unknown device type"));
goto error;
}
#ifndef PROXY
-static char *virDomainDefDefaultEmulator(virConnectPtr conn,
- virDomainDefPtr def,
+static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
virCapsPtr caps) {
const char *type;
const char *emulator;
type = virDomainVirtTypeToString(def->virtType);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unknown virt type"));
return NULL;
}
type);
if (!emulator) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("no emulator for domain %s os type %s on architecture %s"),
type, def->os.type, def->os.arch);
return NULL;
return retemu;
}
-static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
- virCapsPtr caps,
+static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
xmlXPathContextPtr ctxt, int flags)
{
xmlNodePtr *nodes = NULL, node = NULL;
/* Find out what type of virtualization to use */
if (!(tmp = virXPathString("string(./@type)", ctxt))) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing domain type attribute"));
goto error;
}
if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid domain type %s"), tmp);
goto error;
}
/* Extract domain name */
if (!(def->name = virXPathString("string(./name[1])", ctxt))) {
- virDomainReportError(conn, VIR_ERR_NO_NAME, NULL);
+ virDomainReportError(VIR_ERR_NO_NAME, NULL);
goto error;
}
tmp = virXPathString("string(./uuid[1])", ctxt);
if (!tmp) {
if (virUUIDGenerate(def->uuid)) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to generate UUID"));
goto error;
}
} else {
if (virUUIDParse(tmp, def->uuid) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed uuid element"));
goto error;
}
/* Extract domain memory */
if (virXPathULong("string(./memory[1])", ctxt, &def->maxmem) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing memory element"));
goto error;
}
virReportOOMError();
goto error;
}
- if (virDomainCpuSetParse(conn, (const char **)&set,
+ if (virDomainCpuSetParse((const char **)&set,
0, def->cpumask,
def->cpumasklen) < 0)
goto error;
for (i = 0 ; i < n ; i++) {
int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
if (val < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected feature %s"),
nodes[i]->name);
goto error;
VIR_FREE(nodes);
}
- if (virDomainLifecycleParseXML(conn, ctxt, "string(./on_reboot[1])",
+ if (virDomainLifecycleParseXML(ctxt, "string(./on_reboot[1])",
&def->onReboot, VIR_DOMAIN_LIFECYCLE_RESTART) < 0)
goto error;
- if (virDomainLifecycleParseXML(conn, ctxt, "string(./on_poweroff[1])",
+ if (virDomainLifecycleParseXML(ctxt, "string(./on_poweroff[1])",
&def->onPoweroff, VIR_DOMAIN_LIFECYCLE_DESTROY) < 0)
goto error;
- if (virDomainLifecycleParseXML(conn, ctxt, "string(./on_crash[1])",
+ if (virDomainLifecycleParseXML(ctxt, "string(./on_crash[1])",
&def->onCrash, VIR_DOMAIN_LIFECYCLE_DESTROY) < 0)
goto error;
goto error;
}
} else {
- virDomainReportError(conn, VIR_ERR_OS_TYPE,
+ virDomainReportError(VIR_ERR_OS_TYPE,
"%s", _("no OS type"));
goto error;
}
}
if (!virCapabilitiesSupportsGuestOSType(caps, def->os.type)) {
- virDomainReportError(conn, VIR_ERR_OS_TYPE,
+ virDomainReportError(VIR_ERR_OS_TYPE,
"%s", def->os.type);
goto error;
}
def->os.arch = virXPathString("string(./os/type[1]/@arch)", ctxt);
if (def->os.arch) {
if (!virCapabilitiesSupportsGuestArch(caps, def->os.type, def->os.arch)) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("os type '%s' & arch '%s' combination is not supported"),
def->os.type, def->os.arch);
goto error;
} else {
const char *defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType));
if (defaultArch == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("no supported architecture for os type '%s'"),
def->os.type);
goto error;
if (STREQ(def->os.type, "hvm")) {
/* analysis of the boot devices */
if ((n = virXPathNodeSet("./os/boot", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract boot device"));
goto error;
}
int val;
char *dev = virXMLPropString(nodes[i], "dev");
if (!dev) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing boot device"));
goto error;
}
if ((val = virDomainBootTypeFromString(dev)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown boot device '%s'"),
dev);
VIR_FREE(dev);
def->emulator = virXPathString("string(./devices/emulator[1])", ctxt);
if (!def->emulator && virCapabilitiesIsEmulatorRequired(caps)) {
- def->emulator = virDomainDefDefaultEmulator(conn, def, caps);
+ def->emulator = virDomainDefDefaultEmulator(def, caps);
if (!def->emulator)
goto error;
}
/* analysis of the disk devices */
if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract disk devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->disks, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainDiskDefPtr disk = virDomainDiskDefParseXML(conn,
- nodes[i],
+ virDomainDiskDefPtr disk = virDomainDiskDefParseXML(nodes[i],
flags);
if (!disk)
goto error;
/* analysis of the controller devices */
if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract controller devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->controllers, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainControllerDefPtr controller = virDomainControllerDefParseXML(conn,
- nodes[i],
+ virDomainControllerDefPtr controller = virDomainControllerDefParseXML(nodes[i],
flags);
if (!controller)
goto error;
/* analysis of the filesystems */
if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract filesystem devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->fss, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainFSDefPtr fs = virDomainFSDefParseXML(conn,
- nodes[i],
+ virDomainFSDefPtr fs = virDomainFSDefParseXML(nodes[i],
flags);
if (!fs)
goto error;
/* analysis of the network devices */
if ((n = virXPathNodeSet("./devices/interface", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract network devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->nets, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainNetDefPtr net = virDomainNetDefParseXML(conn,
- caps,
+ virDomainNetDefPtr net = virDomainNetDefParseXML(caps,
nodes[i],
flags);
if (!net)
/* analysis of the character devices */
if ((n = virXPathNodeSet("./devices/parallel", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract parallel devices"));
goto error;
}
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
- nodes[i],
+ virDomainChrDefPtr chr = virDomainChrDefParseXML(nodes[i],
flags);
if (!chr)
goto error;
VIR_FREE(nodes);
if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract serial devices"));
goto error;
}
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
- nodes[i],
+ virDomainChrDefPtr chr = virDomainChrDefParseXML(nodes[i],
flags);
if (!chr)
goto error;
VIR_FREE(nodes);
if ((node = virXPathNode("./devices/console[1]", ctxt)) != NULL) {
- virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
- node,
+ virDomainChrDefPtr chr = virDomainChrDefParseXML(node,
flags);
if (!chr)
goto error;
}
if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract channel devices"));
goto error;
}
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
- nodes[i],
+ virDomainChrDefPtr chr = virDomainChrDefParseXML(nodes[i],
flags);
if (!chr)
goto error;
/* analysis of the input devices */
if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract input devices"));
goto error;
}
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainInputDefPtr input = virDomainInputDefParseXML(conn,
- def->os.type,
+ virDomainInputDefPtr input = virDomainInputDefParseXML(def->os.type,
nodes[i],
flags);
if (!input)
/* analysis of the graphics devices */
if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract graphics devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->graphics, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(conn,
- nodes[i],
+ virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(nodes[i],
flags);
if (!graphics)
goto error;
/* analysis of the sound devices */
if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract sound devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->sounds, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainSoundDefPtr sound = virDomainSoundDefParseXML(conn,
- nodes[i],
+ virDomainSoundDefPtr sound = virDomainSoundDefParseXML(nodes[i],
flags);
if (!sound)
goto error;
/* analysis of the video devices */
if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract video devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->videos, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainVideoDefPtr video = virDomainVideoDefParseXML(conn,
- nodes[i],
+ virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[i],
def,
flags);
if (!video)
goto no_memory;
video->type = virDomainVideoDefaultType(def);
if (video->type < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot determine default video type"));
VIR_FREE(video);
goto error;
/* analysis of the host devices */
if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract host devices"));
goto error;
}
if (n && VIR_ALLOC_N(def->hostdevs, n) < 0)
goto no_memory;
for (i = 0 ; i < n ; i++) {
- virDomainHostdevDefPtr hostdev = virDomainHostdevDefParseXML(conn,
- nodes[i],
+ virDomainHostdevDefPtr hostdev = virDomainHostdevDefParseXML(nodes[i],
flags);
if (!hostdev)
goto error;
/* analysis of the watchdog devices */
def->watchdog = NULL;
if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract watchdog devices"));
goto error;
}
if (n > 1) {
- virDomainReportError (conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError (VIR_ERR_INTERNAL_ERROR,
"%s", _("only a single watchdog device is supported"));
goto error;
}
if (n > 0) {
virDomainWatchdogDefPtr watchdog =
- virDomainWatchdogDefParseXML(conn, nodes[0], flags);
+ virDomainWatchdogDefParseXML(nodes[0], flags);
if (!watchdog)
goto error;
}
/* analysis of security label */
- if (virSecurityLabelDefParseXML(conn, def, ctxt, flags) == -1)
+ if (virSecurityLabelDefParseXML(def, ctxt, flags) == -1)
goto error;
if ((node = virXPathNode("./cpu[1]", ctxt)) != NULL) {
xmlNodePtr oldnode = ctxt->node;
ctxt->node = node;
- def->cpu = virCPUDefParseXML(conn, node, ctxt, VIR_CPU_TYPE_GUEST);
+ def->cpu = virCPUDefParseXML(NULL, node, ctxt, VIR_CPU_TYPE_GUEST);
ctxt->node = oldnode;
if (def->cpu == NULL)
}
-static virDomainObjPtr virDomainObjParseXML(virConnectPtr conn,
- virCapsPtr caps,
+static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
xmlXPathContextPtr ctxt)
{
char *tmp = NULL;
xmlNodePtr oldnode;
virDomainObjPtr obj;
- if (!(obj = virDomainObjNew(conn, caps)))
+ if (!(obj = virDomainObjNew(caps)))
return NULL;
if (!(config = virXPathNode("./domain", ctxt))) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no domain config"));
goto error;
}
oldnode = ctxt->node;
ctxt->node = config;
- obj->def = virDomainDefParseXML(conn, caps, ctxt,
+ obj->def = virDomainDefParseXML(caps, ctxt,
VIR_DOMAIN_XML_INTERNAL_STATUS);
ctxt->node = oldnode;
if (!obj->def)
goto error;
if (!(tmp = virXPathString("string(./@state)", ctxt))) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing domain state"));
goto error;
}
if ((obj->state = virDomainStateTypeFromString(tmp)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid domain state '%s'"), tmp);
VIR_FREE(tmp);
goto error;
VIR_FREE(tmp);
if ((virXPathLong("string(./@pid)", ctxt, &val)) < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid pid"));
goto error;
}
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt) {
- virConnectPtr conn = ctxt->_private;
-
if (virGetLastError() == NULL &&
ctxt->lastError.level == XML_ERR_FATAL &&
ctxt->lastError.message != NULL) {
- virDomainReportError (conn, VIR_ERR_XML_DETAIL,
- _("at line %d: %s"),
- ctxt->lastError.line,
- ctxt->lastError.message);
+ virDomainReportError(VIR_ERR_XML_DETAIL,
+ _("at line %d: %s"),
+ ctxt->lastError.line,
+ ctxt->lastError.message);
}
}
}
-virDomainDefPtr virDomainDefParseString(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
const char *xmlStr,
int flags)
{
if (!pctxt || !pctxt->sax)
goto cleanup;
pctxt->sax->error = catchXMLError;
- pctxt->_private = conn;
- if (conn) virResetError (&conn->err);
xml = xmlCtxtReadDoc (pctxt, BAD_CAST xmlStr, "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
if (!xml) {
if (virGetLastError() == NULL)
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse xml document"));
goto cleanup;
}
if ((root = xmlDocGetRootElement(xml)) == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing root element"));
goto cleanup;
}
- def = virDomainDefParseNode(conn, caps, xml, root, flags);
+ def = virDomainDefParseNode(caps, xml, root, flags);
cleanup:
xmlFreeParserCtxt (pctxt);
return def;
}
-virDomainDefPtr virDomainDefParseFile(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
const char *filename, int flags)
{
xmlParserCtxtPtr pctxt;
if (!pctxt || !pctxt->sax)
goto cleanup;
pctxt->sax->error = catchXMLError;
- pctxt->_private = conn;
- if (conn) virResetError (&conn->err);
xml = xmlCtxtReadFile (pctxt, filename, NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
if (!xml) {
if (virGetLastError() == NULL)
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse xml document"));
goto cleanup;
}
if ((root = xmlDocGetRootElement(xml)) == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing root element"));
goto cleanup;
}
- def = virDomainDefParseNode(conn, caps, xml, root, flags);
+ def = virDomainDefParseNode(caps, xml, root, flags);
cleanup:
xmlFreeParserCtxt (pctxt);
}
-virDomainDefPtr virDomainDefParseNode(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDefPtr virDomainDefParseNode(virCapsPtr caps,
xmlDocPtr xml,
xmlNodePtr root,
int flags)
virDomainDefPtr def = NULL;
if (!xmlStrEqual(root->name, BAD_CAST "domain")) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("incorrect root element"));
goto cleanup;
}
}
ctxt->node = root;
- def = virDomainDefParseXML(conn, caps, ctxt, flags);
+ def = virDomainDefParseXML(caps, ctxt, flags);
cleanup:
xmlXPathFreeContext(ctxt);
}
-virDomainObjPtr virDomainObjParseFile(virConnectPtr conn,
- virCapsPtr caps,
+virDomainObjPtr virDomainObjParseFile(virCapsPtr caps,
const char *filename)
{
xmlParserCtxtPtr pctxt;
if (!pctxt || !pctxt->sax)
goto cleanup;
pctxt->sax->error = catchXMLError;
- pctxt->_private = conn;
- if (conn) virResetError (&conn->err);
xml = xmlCtxtReadFile (pctxt, filename, NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOWARNING);
if (!xml) {
if (virGetLastError() == NULL)
- virDomainReportError(conn, VIR_ERR_XML_ERROR,
+ virDomainReportError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse xml document"));
goto cleanup;
}
if ((root = xmlDocGetRootElement(xml)) == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing root element"));
goto cleanup;
}
- obj = virDomainObjParseNode(conn, caps, xml, root);
+ obj = virDomainObjParseNode(caps, xml, root);
cleanup:
xmlFreeParserCtxt (pctxt);
}
-virDomainObjPtr virDomainObjParseNode(virConnectPtr conn,
- virCapsPtr caps,
+virDomainObjPtr virDomainObjParseNode(virCapsPtr caps,
xmlDocPtr xml,
xmlNodePtr root)
{
virDomainObjPtr obj = NULL;
if (!xmlStrEqual(root->name, BAD_CAST "domstatus")) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("incorrect root element"));
goto cleanup;
}
}
ctxt->node = root;
- obj = virDomainObjParseXML(conn, caps, ctxt);
+ obj = virDomainObjParseXML(caps, ctxt);
cleanup:
xmlXPathFreeContext(ctxt);
* freed by the caller.
*/
char *
-virDomainCpuSetFormat(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/, char *cpuset, int maxcpu)
+virDomainCpuSetFormat(char *cpuset, int maxcpu)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
int start, cur;
* @str is updated to the end of the part parsed
*/
int
-virDomainCpuSetParse(virConnectPtr conn, const char **str, char sep,
+virDomainCpuSetParse(const char **str, char sep,
char *cpuset, int maxcpu)
{
const char *cur;
return (ret);
parse_error:
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("topology cpuset syntax error"));
return (-1);
}
static int
-virDomainLifecycleDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainLifecycleDefFormat(virBufferPtr buf,
int type,
const char *name)
{
const char *typeStr = virDomainLifecycleTypeToString(type);
if (!typeStr) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle type %d"), type);
return -1;
}
static int
-virDomainDiskDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainDiskDefFormat(virBufferPtr buf,
virDomainDiskDefPtr def,
int flags)
{
const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %d"), def->type);
return -1;
}
if (!device) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk device %d"), def->device);
return -1;
}
if (!bus) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk bus %d"), def->bus);
return -1;
}
if (!cachemode) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk cache mode %d"), def->cachemode);
return -1;
}
def->src);
break;
default:
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected disk type %s"),
virDomainDiskTypeToString(def->type));
return -1;
virBufferEscapeString(buf, " <serial>%s</serial>\n",
def->serial);
if (def->encryption != NULL &&
- virStorageEncryptionFormat(conn, buf, def->encryption) < 0)
+ virStorageEncryptionFormat(NULL, buf, def->encryption) < 0)
return -1;
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
}
static int
-virDomainControllerDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainControllerDefFormat(virBufferPtr buf,
virDomainControllerDefPtr def,
int flags)
{
const char *type = virDomainControllerTypeToString(def->type);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected controller type %d"), def->type);
return -1;
}
}
static int
-virDomainFSDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainFSDefFormat(virBufferPtr buf,
virDomainFSDefPtr def,
int flags)
{
const char *type = virDomainFSTypeToString(def->type);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected filesystem type %d"), def->type);
return -1;
}
}
static int
-virDomainNetDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainNetDefFormat(virBufferPtr buf,
virDomainNetDefPtr def,
int flags)
{
const char *type = virDomainNetTypeToString(def->type);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected net type %d"), def->type);
return -1;
}
static int
-virDomainChrDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainChrDefFormat(virBufferPtr buf,
virDomainChrDefPtr def,
int flags)
{
}
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected char type %d"), def->type);
return -1;
}
{
int port = virSocketGetPort(def->target.addr);
if (port < 0) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to format guestfwd port"));
return -1;
}
const char *addr = virSocketFormatAddr(def->target.addr);
if (addr == NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to format guestfwd address"));
return -1;
}
break;
default:
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected character destination type %d"),
def->targetType);
return -1;
}
static int
-virDomainSoundDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainSoundDefFormat(virBufferPtr buf,
virDomainSoundDefPtr def,
int flags)
{
const char *model = virDomainSoundModelTypeToString(def->model);
if (!model) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sound model %d"), def->model);
return -1;
}
static int
-virDomainWatchdogDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainWatchdogDefFormat(virBufferPtr buf,
virDomainWatchdogDefPtr def,
int flags)
{
const char *action = virDomainWatchdogActionTypeToString (def->action);
if (!model) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected watchdog model %d"), def->model);
return -1;
}
if (!action) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected watchdog action %d"), def->action);
return -1;
}
static int
-virDomainVideoDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainVideoDefFormat(virBufferPtr buf,
virDomainVideoDefPtr def,
int flags)
{
const char *model = virDomainVideoTypeToString(def->type);
if (!model) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected video model %d"), def->type);
return -1;
}
}
static int
-virDomainInputDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainInputDefFormat(virBufferPtr buf,
virDomainInputDefPtr def,
int flags)
{
const char *bus = virDomainInputBusTypeToString(def->bus);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected input type %d"), def->type);
return -1;
}
if (!bus) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected input bus type %d"), def->bus);
return -1;
}
static int
-virDomainGraphicsDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainGraphicsDefFormat(virBufferPtr buf,
virDomainGraphicsDefPtr def,
int flags)
{
const char *type = virDomainGraphicsTypeToString(def->type);
if (!type) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected net type %d"), def->type);
return -1;
}
static int
-virDomainHostdevDefFormat(virConnectPtr conn,
- virBufferPtr buf,
+virDomainHostdevDefFormat(virBufferPtr buf,
virDomainHostdevDefPtr def,
int flags)
{
const char *type;
if (!mode || def->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected hostdev mode %d"), def->mode);
return -1;
}
type = virDomainHostdevSubsysTypeToString(def->source.subsys.type);
if (!type || (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB && def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) ) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected hostdev type %d"),
def->source.subsys.type);
return -1;
}
-char *virDomainDefFormat(virConnectPtr conn,
- virDomainDefPtr def,
+char *virDomainDefFormat(virDomainDefPtr def,
int flags)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
int n, allones = 1;
if (!(type = virDomainVirtTypeToString(def->virtType))) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected domain type %d"), def->virtType);
goto cleanup;
}
} else {
char *cpumask = NULL;
if ((cpumask =
- virDomainCpuSetFormat(conn, def->cpumask, def->cpumasklen)) == NULL)
+ virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL)
goto cleanup;
virBufferVSprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n",
cpumask, def->vcpus);
const char *boottype =
virDomainBootTypeToString(def->os.bootDevs[n]);
if (!boottype) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected boot device type %d"),
def->os.bootDevs[n]);
goto cleanup;
if (def->features & (1 << i)) {
const char *name = virDomainFeatureTypeToString(i);
if (!name) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected feature %d"), i);
goto cleanup;
}
virBufferAddLit(&buf, " </features>\n");
}
- if (virCPUDefFormatBuf(conn, &buf, def->cpu, " ", 0) < 0)
+ if (virCPUDefFormatBuf(NULL, &buf, def->cpu, " ", 0) < 0)
goto cleanup;
virBufferVSprintf(&buf, " <clock offset='%s'/>\n",
def->localtime ? "localtime" : "utc");
- if (virDomainLifecycleDefFormat(conn, &buf, def->onPoweroff,
+ if (virDomainLifecycleDefFormat(&buf, def->onPoweroff,
"on_poweroff") < 0)
goto cleanup;
- if (virDomainLifecycleDefFormat(conn, &buf, def->onReboot,
+ if (virDomainLifecycleDefFormat(&buf, def->onReboot,
"on_reboot") < 0)
goto cleanup;
- if (virDomainLifecycleDefFormat(conn, &buf, def->onCrash,
+ if (virDomainLifecycleDefFormat(&buf, def->onCrash,
"on_crash") < 0)
goto cleanup;
def->emulator);
for (n = 0 ; n < def->ndisks ; n++)
- if (virDomainDiskDefFormat(conn, &buf, def->disks[n], flags) < 0)
+ if (virDomainDiskDefFormat(&buf, def->disks[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->ncontrollers ; n++)
- if (virDomainControllerDefFormat(conn, &buf, def->controllers[n], flags) < 0)
+ if (virDomainControllerDefFormat(&buf, def->controllers[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nfss ; n++)
- if (virDomainFSDefFormat(conn, &buf, def->fss[n], flags) < 0)
+ if (virDomainFSDefFormat(&buf, def->fss[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nnets ; n++)
- if (virDomainNetDefFormat(conn, &buf, def->nets[n], flags) < 0)
+ if (virDomainNetDefFormat(&buf, def->nets[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nserials ; n++)
- if (virDomainChrDefFormat(conn, &buf, def->serials[n], flags) < 0)
+ if (virDomainChrDefFormat(&buf, def->serials[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nparallels ; n++)
- if (virDomainChrDefFormat(conn, &buf, def->parallels[n], flags) < 0)
+ if (virDomainChrDefFormat(&buf, def->parallels[n], flags) < 0)
goto cleanup;
/* If there's a PV console that's preferred.. */
if (def->console) {
- if (virDomainChrDefFormat(conn, &buf, def->console, flags) < 0)
+ if (virDomainChrDefFormat(&buf, def->console, flags) < 0)
goto cleanup;
} else if (def->nserials != 0) {
/* ..else for legacy compat duplicate the first serial device as a
virDomainChrDef console;
memcpy(&console, def->serials[0], sizeof(console));
console.targetType = VIR_DOMAIN_CHR_TARGET_TYPE_CONSOLE;
- if (virDomainChrDefFormat(conn, &buf, &console, flags) < 0)
+ if (virDomainChrDefFormat(&buf, &console, flags) < 0)
goto cleanup;
}
for (n = 0 ; n < def->nchannels ; n++)
- if (virDomainChrDefFormat(conn, &buf, def->channels[n], flags) < 0)
+ if (virDomainChrDefFormat(&buf, def->channels[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->ninputs ; n++)
if (def->inputs[n]->bus == VIR_DOMAIN_INPUT_BUS_USB &&
- virDomainInputDefFormat(conn, &buf, def->inputs[n], flags) < 0)
+ virDomainInputDefFormat(&buf, def->inputs[n], flags) < 0)
goto cleanup;
if (def->ngraphics > 0) {
{ .alias = NULL },
};
- if (virDomainInputDefFormat(conn, &buf, &autoInput, flags) < 0)
+ if (virDomainInputDefFormat(&buf, &autoInput, flags) < 0)
goto cleanup;
for (n = 0 ; n < def->ngraphics ; n++)
- if (virDomainGraphicsDefFormat(conn, &buf, def->graphics[n], flags) < 0)
+ if (virDomainGraphicsDefFormat(&buf, def->graphics[n], flags) < 0)
goto cleanup;
}
for (n = 0 ; n < def->nsounds ; n++)
- if (virDomainSoundDefFormat(conn, &buf, def->sounds[n], flags) < 0)
+ if (virDomainSoundDefFormat(&buf, def->sounds[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nvideos ; n++)
- if (virDomainVideoDefFormat(conn, &buf, def->videos[n], flags) < 0)
+ if (virDomainVideoDefFormat(&buf, def->videos[n], flags) < 0)
goto cleanup;
for (n = 0 ; n < def->nhostdevs ; n++)
- if (virDomainHostdevDefFormat(conn, &buf, def->hostdevs[n], flags) < 0)
+ if (virDomainHostdevDefFormat(&buf, def->hostdevs[n], flags) < 0)
goto cleanup;
if (def->watchdog)
- virDomainWatchdogDefFormat (conn, &buf, def->watchdog, flags);
+ virDomainWatchdogDefFormat (&buf, def->watchdog, flags);
virBufferAddLit(&buf, " </devices>\n");
return NULL;
}
-char *virDomainObjFormat(virConnectPtr conn,
- virCapsPtr caps,
+char *virDomainObjFormat(virCapsPtr caps,
virDomainObjPtr obj,
int flags)
{
((caps->privateDataXMLFormat)(&buf, obj->privateData)) < 0)
goto error;
- if (!(config_xml = virDomainDefFormat(conn,
- obj->def,
+ if (!(config_xml = virDomainDefFormat(obj->def,
flags)))
goto error;
#ifndef PROXY
-int virDomainSaveXML(virConnectPtr conn,
- const char *configDir,
+int virDomainSaveXML(const char *configDir,
virDomainDefPtr def,
const char *xml)
{
int fd = -1, ret = -1;
size_t towrite;
- if ((configFile = virDomainConfigFile(conn, configDir, def->name)) == NULL)
+ if ((configFile = virDomainConfigFile(configDir, def->name)) == NULL)
goto cleanup;
if (virFileMakePath(configDir)) {
return ret;
}
-int virDomainSaveConfig(virConnectPtr conn,
- const char *configDir,
+int virDomainSaveConfig(const char *configDir,
virDomainDefPtr def)
{
int ret = -1;
char *xml;
- if (!(xml = virDomainDefFormat(conn,
- def,
+ if (!(xml = virDomainDefFormat(def,
VIR_DOMAIN_XML_SECURE)))
goto cleanup;
- if (virDomainSaveXML(conn, configDir, def, xml))
+ if (virDomainSaveXML(configDir, def, xml))
goto cleanup;
ret = 0;
return ret;
}
-int virDomainSaveStatus(virConnectPtr conn,
- virCapsPtr caps,
+int virDomainSaveStatus(virCapsPtr caps,
const char *statusDir,
virDomainObjPtr obj)
{
int ret = -1;
char *xml;
- if (!(xml = virDomainObjFormat(conn, caps, obj, flags)))
+ if (!(xml = virDomainObjFormat(caps, obj, flags)))
goto cleanup;
- if (virDomainSaveXML(conn, statusDir, obj->def, xml))
+ if (virDomainSaveXML(statusDir, obj->def, xml))
goto cleanup;
ret = 0;
}
-virDomainObjPtr virDomainLoadConfig(virConnectPtr conn,
- virCapsPtr caps,
+virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
virDomainObjListPtr doms,
const char *configDir,
const char *autostartDir,
int autostart;
int newVM = 1;
- if ((configFile = virDomainConfigFile(conn, configDir, name)) == NULL)
+ if ((configFile = virDomainConfigFile(configDir, name)) == NULL)
goto error;
- if ((autostartLink = virDomainConfigFile(conn, autostartDir, name)) == NULL)
+ if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
goto error;
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
goto error;
- if (!(def = virDomainDefParseFile(conn, caps, configFile,
+ if (!(def = virDomainDefParseFile(caps, configFile,
VIR_DOMAIN_XML_INACTIVE)))
goto error;
newVM = 0;
}
- if (!(dom = virDomainAssignDef(conn, caps, doms, def)))
+ if (!(dom = virDomainAssignDef(caps, doms, def)))
goto error;
dom->autostart = autostart;
return NULL;
}
-static virDomainObjPtr virDomainLoadStatus(virConnectPtr conn,
- virCapsPtr caps,
+static virDomainObjPtr virDomainLoadStatus(virCapsPtr caps,
virDomainObjListPtr doms,
const char *statusDir,
const char *name,
virDomainObjPtr obj = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
- if ((statusFile = virDomainConfigFile(conn, statusDir, name)) == NULL)
+ if ((statusFile = virDomainConfigFile(statusDir, name)) == NULL)
goto error;
- if (!(obj = virDomainObjParseFile(conn, caps, statusFile)))
+ if (!(obj = virDomainObjParseFile(caps, statusFile)))
goto error;
virUUIDFormat(obj->def->uuid, uuidstr);
if (virHashLookup(doms->objs, uuidstr) != NULL) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected domain %s already exists"),
obj->def->name);
goto error;
return NULL;
}
-int virDomainLoadAllConfigs(virConnectPtr conn,
- virCapsPtr caps,
+int virDomainLoadAllConfigs(virCapsPtr caps,
virDomainObjListPtr doms,
const char *configDir,
const char *autostartDir,
kill the whole process */
VIR_INFO("Loading config file '%s.xml'", entry->d_name);
if (liveStatus)
- dom = virDomainLoadStatus(conn,
- caps,
+ dom = virDomainLoadStatus(caps,
doms,
configDir,
entry->d_name,
notify,
opaque);
else
- dom = virDomainLoadConfig(conn,
- caps,
+ dom = virDomainLoadConfig(caps,
doms,
configDir,
autostartDir,
return 0;
}
-int virDomainDeleteConfig(virConnectPtr conn,
- const char *configDir,
+int virDomainDeleteConfig(const char *configDir,
const char *autostartDir,
virDomainObjPtr dom)
{
char *configFile = NULL, *autostartLink = NULL;
int ret = -1;
- if ((configFile = virDomainConfigFile(conn, configDir, dom->def->name)) == NULL)
+ if ((configFile = virDomainConfigFile(configDir, dom->def->name)) == NULL)
goto cleanup;
- if ((autostartLink = virDomainConfigFile(conn, autostartDir, dom->def->name)) == NULL)
+ if ((autostartLink = virDomainConfigFile(autostartDir, dom->def->name)) == NULL)
goto cleanup;
/* Not fatal if this doesn't work */
return ret;
}
-char *virDomainConfigFile(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- const char *dir,
+char *virDomainConfigFile(const char *dir,
const char *name)
{
char *ret = NULL;
if (STRNEQ(vm->def->name, def->name)) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr);
- virDomainReportError(NULL, VIR_ERR_OPERATION_FAILED,
- _("domain '%s' is already defined with uuid %s"),
- vm->def->name, uuidstr);
+ virDomainReportError(VIR_ERR_OPERATION_FAILED,
+ _("domain '%s' is already defined with uuid %s"),
+ vm->def->name, uuidstr);
goto cleanup;
}
if (check_active) {
/* UUID & name match, but if VM is already active, refuse it */
if (virDomainObjIsActive(vm)) {
- virDomainReportError(NULL, VIR_ERR_OPERATION_INVALID,
+ virDomainReportError(VIR_ERR_OPERATION_INVALID,
_("domain is already active as '%s'"),
vm->def->name);
goto cleanup;
if (vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, uuidstr);
- virDomainReportError(NULL, VIR_ERR_OPERATION_FAILED,
+ virDomainReportError(VIR_ERR_OPERATION_FAILED,
_("domain '%s' already exists with uuid %s"),
def->name, uuidstr);
goto cleanup;