It was used for error reporting only.
+{
+ char *s;
+
-+ s = virXPathString(conn, xpath, ctxt);
++ s = virXPathString(xpath, ctxt);
+ if (s == NULL) {
+ virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ missing_error_fmt,
goto out;
+ }
+
-+ if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) < 0) {
++ if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
+ virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("error parsing SCSI host capabilities for '%s'"),
+ def->name);
}
/* Extract device name */
-- def->name = virXPathString(conn, "string(./name[1])", ctxt);
+- def->name = virXPathString("string(./name[1])", ctxt);
+ if (create == EXISTING_DEVICE) {
-+ def->name = virXPathString(conn, "string(./name[1])", ctxt);
++ def->name = virXPathString("string(./name[1])", ctxt);
+ } else {
+ def->name = strdup("new device");
+ }
}
if (mode == VIR_CPU_TYPE_AUTO) {
- if (virXPathBoolean(conn, "boolean(./arch)", ctxt))
+ if (virXPathBoolean("boolean(./arch)", ctxt))
def->type = VIR_CPU_TYPE_HOST;
else
def->type = VIR_CPU_TYPE_GUEST;
char *match = virXMLPropString(node, "match");
if (!match) {
- if (virXPathBoolean(conn, "boolean(./model)", ctxt)) {
+ if (virXPathBoolean("boolean(./model)", ctxt)) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing match attribute for CPU specification"));
goto error;
}
if (def->type == VIR_CPU_TYPE_HOST) {
- def->arch = virXPathString(conn, "string(./arch[1])", ctxt);
+ def->arch = virXPathString("string(./arch[1])", ctxt);
if (!def->arch) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing CPU architecture"));
}
}
- if (!(def->model = virXPathString(conn, "string(./model[1])", ctxt)) &&
+ if (!(def->model = virXPathString("string(./model[1])", ctxt)) &&
def->type == VIR_CPU_TYPE_HOST) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing CPU model name"));
goto error;
}
- if (virXPathNode(conn, "./topology[1]", ctxt)) {
+ if (virXPathNode("./topology[1]", ctxt)) {
int ret;
unsigned long ul;
- ret = virXPathULong(conn, "string(./topology[1]/@sockets)",
+ ret = virXPathULong("string(./topology[1]/@sockets)",
ctxt, &ul);
if (ret < 0) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
def->sockets = (unsigned int) ul;
- ret = virXPathULong(conn, "string(./topology[1]/@cores)",
+ ret = virXPathULong("string(./topology[1]/@cores)",
ctxt, &ul);
if (ret < 0) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
def->cores = (unsigned int) ul;
- ret = virXPathULong(conn, "string(./topology[1]/@threads)",
+ ret = virXPathULong("string(./topology[1]/@threads)",
ctxt, &ul);
if (ret < 0) {
virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
}
- n = virXPathNodeSet(conn, "./feature", ctxt, &nodes);
+ n = virXPathNodeSet("./feature", ctxt, &nodes);
if (n < 0)
goto error;
int *val,
int defaultVal)
{
- char *tmp = virXPathString(conn, xpath, ctxt);
+ char *tmp = virXPathString(xpath, ctxt);
if (tmp == NULL) {
*val = defaultVal;
} else {
{
char *p;
- if (virXPathNode(conn, "./seclabel", ctxt) == NULL)
+ if (virXPathNode("./seclabel", ctxt) == NULL)
return 0;
- p = virXPathStringLimit(conn, "string(./seclabel/@type)",
+ p = virXPathStringLimit("string(./seclabel/@type)",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
virDomainReportError(conn, VIR_ERR_XML_ERROR,
*/
if (def->seclabel.type == VIR_DOMAIN_SECLABEL_STATIC ||
!(flags & VIR_DOMAIN_XML_INACTIVE)) {
- p = virXPathStringLimit(conn, "string(./seclabel/@model)",
+ p = virXPathStringLimit("string(./seclabel/@model)",
VIR_SECURITY_MODEL_BUFLEN-1, ctxt);
if (p == NULL) {
virDomainReportError(conn, VIR_ERR_XML_ERROR,
}
def->seclabel.model = p;
- p = virXPathStringLimit(conn, "string(./seclabel/label[1])",
+ p = virXPathStringLimit("string(./seclabel/label[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
virDomainReportError(conn, VIR_ERR_XML_ERROR,
/* Only parse imagelabel, if requested live XML for dynamic label */
if (def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC &&
!(flags & VIR_DOMAIN_XML_INACTIVE)) {
- p = virXPathStringLimit(conn, "string(./seclabel/imagelabel[1])",
+ p = virXPathStringLimit("string(./seclabel/imagelabel[1])",
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
if (p == NULL) {
virDomainReportError(conn, VIR_ERR_XML_ERROR,
}
if (!(flags & VIR_DOMAIN_XML_INACTIVE))
- if ((virXPathLong(conn, "string(./@id)", ctxt, &id)) < 0)
+ if ((virXPathLong("string(./@id)", ctxt, &id)) < 0)
id = -1;
def->id = (int)id;
/* Find out what type of virtualization to use */
- if (!(tmp = virXPathString(conn, "string(./@type)", ctxt))) {
+ if (!(tmp = virXPathString("string(./@type)", ctxt))) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing domain type attribute"));
goto error;
VIR_FREE(tmp);
/* Extract domain name */
- if (!(def->name = virXPathString(conn, "string(./name[1])", ctxt))) {
+ if (!(def->name = virXPathString("string(./name[1])", ctxt))) {
virDomainReportError(conn, VIR_ERR_NO_NAME, NULL);
goto error;
}
/* Extract domain uuid */
- tmp = virXPathString(conn, "string(./uuid[1])", ctxt);
+ tmp = virXPathString("string(./uuid[1])", ctxt);
if (!tmp) {
if (virUUIDGenerate(def->uuid)) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
/* Extract documentation if present */
- def->description = virXPathString(conn, "string(./description[1])", ctxt);
+ def->description = virXPathString("string(./description[1])", ctxt);
/* Extract domain memory */
- if (virXPathULong(conn, "string(./memory[1])", ctxt, &def->maxmem) < 0) {
+ if (virXPathULong("string(./memory[1])", ctxt, &def->maxmem) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing memory element"));
goto error;
}
- if (virXPathULong(conn, "string(./currentMemory[1])", ctxt, &def->memory) < 0)
+ if (virXPathULong("string(./currentMemory[1])", ctxt, &def->memory) < 0)
def->memory = def->maxmem;
- node = virXPathNode(conn, "./memoryBacking/hugepages", ctxt);
+ node = virXPathNode("./memoryBacking/hugepages", ctxt);
if (node)
def->hugepage_backed = 1;
- if (virXPathULong(conn, "string(./vcpu[1])", ctxt, &def->vcpus) < 0)
+ if (virXPathULong("string(./vcpu[1])", ctxt, &def->vcpus) < 0)
def->vcpus = 1;
- tmp = virXPathString(conn, "string(./vcpu[1]/@cpuset)", ctxt);
+ tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
if (tmp) {
char *set = tmp;
def->cpumasklen = VIR_DOMAIN_CPUMASK_LEN;
VIR_FREE(tmp);
}
- n = virXPathNodeSet(conn, "./features/*", ctxt, &nodes);
+ n = virXPathNodeSet("./features/*", ctxt, &nodes);
if (n < 0)
goto error;
if (n) {
goto error;
- tmp = virXPathString(conn, "string(./clock/@offset)", ctxt);
+ tmp = virXPathString("string(./clock/@offset)", ctxt);
if (tmp && STREQ(tmp, "localtime"))
def->localtime = 1;
VIR_FREE(tmp);
- def->os.bootloader = virXPathString(conn, "string(./bootloader)", ctxt);
- def->os.bootloaderArgs = virXPathString(conn, "string(./bootloader_args)", ctxt);
+ def->os.bootloader = virXPathString("string(./bootloader)", ctxt);
+ def->os.bootloaderArgs = virXPathString("string(./bootloader_args)", ctxt);
- def->os.type = virXPathString(conn, "string(./os/type[1])", ctxt);
+ def->os.type = virXPathString("string(./os/type[1])", ctxt);
if (!def->os.type) {
if (def->os.bootloader) {
def->os.type = strdup("xen");
goto error;
}
- def->os.arch = virXPathString(conn, "string(./os/type[1]/@arch)", ctxt);
+ 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,
}
}
- def->os.machine = virXPathString(conn, "string(./os/type[1]/@machine)", ctxt);
+ def->os.machine = virXPathString("string(./os/type[1]/@machine)", ctxt);
if (!def->os.machine) {
const char *defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
def->os.type,
*/
if (STREQ(def->os.type, "exe")) {
- def->os.init = virXPathString(conn, "string(./os/init[1])", ctxt);
+ def->os.init = virXPathString("string(./os/init[1])", ctxt);
}
if (STREQ(def->os.type, "xen") ||
STREQ(def->os.type, "hvm") ||
STREQ(def->os.type, "uml")) {
- def->os.kernel = virXPathString(conn, "string(./os/kernel[1])", ctxt);
- def->os.initrd = virXPathString(conn, "string(./os/initrd[1])", ctxt);
- def->os.cmdline = virXPathString(conn, "string(./os/cmdline[1])", ctxt);
- def->os.root = virXPathString(conn, "string(./os/root[1])", ctxt);
- def->os.loader = virXPathString(conn, "string(./os/loader[1])", ctxt);
+ def->os.kernel = virXPathString("string(./os/kernel[1])", ctxt);
+ def->os.initrd = virXPathString("string(./os/initrd[1])", ctxt);
+ def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
+ def->os.root = virXPathString("string(./os/root[1])", ctxt);
+ def->os.loader = virXPathString("string(./os/loader[1])", ctxt);
}
if (STREQ(def->os.type, "hvm")) {
/* analysis of the boot devices */
- if ((n = virXPathNodeSet(conn, "./os/boot", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./os/boot", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract boot device"));
goto error;
VIR_FREE(nodes);
}
- def->emulator = virXPathString(conn, "string(./devices/emulator[1])", ctxt);
+ def->emulator = virXPathString("string(./devices/emulator[1])", ctxt);
if (!def->emulator && virCapabilitiesIsEmulatorRequired(caps)) {
def->emulator = virDomainDefDefaultEmulator(conn, def, caps);
if (!def->emulator)
}
/* analysis of the disk devices */
- if ((n = virXPathNodeSet(conn, "./devices/disk", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract disk devices"));
goto error;
VIR_FREE(nodes);
/* analysis of the controller devices */
- if ((n = virXPathNodeSet(conn, "./devices/controller", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract controller devices"));
goto error;
goto error;
/* analysis of the filesystems */
- if ((n = virXPathNodeSet(conn, "./devices/filesystem", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/filesystem", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract filesystem devices"));
goto error;
VIR_FREE(nodes);
/* analysis of the network devices */
- if ((n = virXPathNodeSet(conn, "./devices/interface", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/interface", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract network devices"));
goto error;
/* analysis of the character devices */
- if ((n = virXPathNodeSet(conn, "./devices/parallel", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/parallel", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract parallel devices"));
goto error;
}
VIR_FREE(nodes);
- if ((n = virXPathNodeSet(conn, "./devices/serial", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/serial", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract serial devices"));
goto error;
}
VIR_FREE(nodes);
- if ((node = virXPathNode(conn, "./devices/console[1]", ctxt)) != NULL) {
+ if ((node = virXPathNode("./devices/console[1]", ctxt)) != NULL) {
virDomainChrDefPtr chr = virDomainChrDefParseXML(conn,
node,
flags);
}
}
- if ((n = virXPathNodeSet(conn, "./devices/channel", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/channel", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract channel devices"));
goto error;
/* analysis of the input devices */
- if ((n = virXPathNodeSet(conn, "./devices/input", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/input", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract input devices"));
goto error;
VIR_FREE(nodes);
/* analysis of the graphics devices */
- if ((n = virXPathNodeSet(conn, "./devices/graphics", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract graphics devices"));
goto error;
/* analysis of the sound devices */
- if ((n = virXPathNodeSet(conn, "./devices/sound", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract sound devices"));
goto error;
VIR_FREE(nodes);
/* analysis of the video devices */
- if ((n = virXPathNodeSet(conn, "./devices/video", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract video devices"));
goto error;
}
/* analysis of the host devices */
- if ((n = virXPathNodeSet(conn, "./devices/hostdev", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/hostdev", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract host devices"));
goto error;
/* analysis of the watchdog devices */
def->watchdog = NULL;
- if ((n = virXPathNodeSet(conn, "./devices/watchdog", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./devices/watchdog", ctxt, &nodes)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot extract watchdog devices"));
goto error;
if (virSecurityLabelDefParseXML(conn, def, ctxt, flags) == -1)
goto error;
- if ((node = virXPathNode(conn, "./cpu[1]", ctxt)) != NULL) {
+ if ((node = virXPathNode("./cpu[1]", ctxt)) != NULL) {
xmlNodePtr oldnode = ctxt->node;
ctxt->node = node;
def->cpu = virCPUDefParseXML(conn, node, ctxt, VIR_CPU_TYPE_GUEST);
if (!(obj = virDomainObjNew(conn, caps)))
return NULL;
- if (!(config = virXPathNode(conn, "./domain", ctxt))) {
+ if (!(config = virXPathNode("./domain", ctxt))) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("no domain config"));
goto error;
if (!obj->def)
goto error;
- if (!(tmp = virXPathString(conn, "string(./@state)", ctxt))) {
+ if (!(tmp = virXPathString("string(./@state)", ctxt))) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing domain state"));
goto error;
}
VIR_FREE(tmp);
- if ((virXPathLong(conn, "string(./@pid)", ctxt, &val)) < 0) {
+ if ((virXPathLong("string(./@pid)", ctxt, &val)) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("invalid pid"));
goto error;
xmlXPathContextPtr ctxt) {
char *tmp;
- tmp = virXPathString(conn, "string(./@name)", ctxt);
+ tmp = virXPathString("string(./@name)", ctxt);
if (tmp == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("interface has no name"));
unsigned long mtu;
int ret;
- ret = virXPathULong(conn, "string(./mtu/@size)", ctxt, &mtu);
+ ret = virXPathULong("string(./mtu/@size)", ctxt, &mtu);
if ((ret == -2) || ((ret == 0) && (mtu > 100000))) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("interface mtu value is improper"));
xmlXPathContextPtr ctxt) {
char *tmp;
- tmp = virXPathString(conn, "string(./start/@mode)", ctxt);
+ tmp = virXPathString("string(./start/@mode)", ctxt);
if (tmp == NULL)
def->startmode = VIR_INTERFACE_START_UNSPECIFIED;
else if (STREQ(tmp, "onboot"))
char *tmp;
int ret = 0;
- tmp = virXPathString(conn, "string(./@mode)", ctxt);
+ tmp = virXPathString("string(./@mode)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_NONE);
if (STREQ(tmp, "balance-rr"))
char *tmp;
int ret = 0;
- tmp = virXPathString(conn, "string(./miimon/@carrier)", ctxt);
+ tmp = virXPathString("string(./miimon/@carrier)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_MII_NONE);
if (STREQ(tmp, "ioctl"))
char *tmp;
int ret = 0;
- tmp = virXPathString(conn, "string(./arpmon/@validate)", ctxt);
+ tmp = virXPathString("string(./arpmon/@validate)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_ARP_NONE);
if (STREQ(tmp, "active"))
save = ctxt->node;
ctxt->node = dhcp;
/* Not much to do in the current version */
- tmp = virXPathString(conn, "string(./@peerdns)", ctxt);
+ tmp = virXPathString("string(./@peerdns)", ctxt);
if (tmp) {
if (STREQ(tmp, "yes"))
def->peerdns = 1;
char *tmp;
long l;
- tmp = virXPathString(conn, "string(./@address)", ctxt);
+ tmp = virXPathString("string(./@address)", ctxt);
def->address = tmp;
if (tmp != NULL) {
- ret = virXPathLong(conn, "string(./@prefix)", ctxt, &l);
+ ret = virXPathLong("string(./@prefix)", ctxt, &l);
if (ret == 0)
def->prefix = (int) l;
else if (ret == -2) {
int nIpNodes, ii, ret = -1;
char *tmp;
- tmp = virXPathString(conn, "string(./route[1]/@gateway)", ctxt);
+ tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
def->gateway = tmp;
- dhcp = virXPathNode(conn, "./dhcp", ctxt);
+ dhcp = virXPathNode("./dhcp", ctxt);
if (dhcp != NULL) {
ret = virInterfaceDefParseDhcp(conn, def, dhcp, ctxt);
if (ret != 0)
return(ret);
}
- nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+ nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
if (nIpNodes < 0)
return -1;
if (ipNodes == NULL)
int nIpNodes, ii, ret = -1;
char *tmp;
- tmp = virXPathString(conn, "string(./route[1]/@gateway)", ctxt);
+ tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
def->gateway = tmp;
- autoconf = virXPathNode(conn, "./autoconf", ctxt);
+ autoconf = virXPathNode("./autoconf", ctxt);
if (autoconf != NULL)
def->autoconf = 1;
- dhcp = virXPathNode(conn, "./dhcp", ctxt);
+ dhcp = virXPathNode("./dhcp", ctxt);
if (dhcp != NULL) {
ret = virInterfaceDefParseDhcp(conn, def, dhcp, ctxt);
if (ret != 0)
return(ret);
}
- nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
+ nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
if (nIpNodes < 0)
return -1;
if (ipNodes == NULL)
save = ctxt->node;
- nProtoNodes = virXPathNodeSet(conn, "./protocol", ctxt, &protoNodes);
+ nProtoNodes = virXPathNodeSet("./protocol", ctxt, &protoNodes);
if (nProtoNodes <= 0) {
/* no protocols is an acceptable outcome */
return 0;
}
ctxt->node = protoNodes[pp];
- tmp = virXPathString(conn, "string(./@family)", ctxt);
+ tmp = virXPathString("string(./@family)", ctxt);
if (tmp == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("protocol misses the family attribute"));
int ret = 0;
bridge = ctxt->node;
- nbItf = virXPathNodeSet(conn, "./interface", ctxt, &interfaces);
+ nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
if (nbItf < 0) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bridge interfaces"));
int nbItf, i;
int ret = 0;
- nbItf = virXPathNodeSet(conn, "./interface", ctxt, &interfaces);
+ nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
if (nbItf <= 0) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond has no interfaces"));
if (ret != 0)
goto error;
- node = virXPathNode(conn, "./miimon[1]", ctxt);
+ node = virXPathNode("./miimon[1]", ctxt);
if (node != NULL) {
def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_MII;
- ret = virXPathULong(conn, "string(./miimon/@freq)", ctxt, &tmp);
+ ret = virXPathULong("string(./miimon/@freq)", ctxt, &tmp);
if ((ret == -2) || (ret == -1)) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon freq missing or invalid"));
}
def->data.bond.frequency = (int) tmp;
- ret = virXPathULong(conn, "string(./miimon/@downdelay)", ctxt, &tmp);
+ ret = virXPathULong("string(./miimon/@downdelay)", ctxt, &tmp);
if (ret == -2) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon downdelay invalid"));
def->data.bond.downdelay = (int) tmp;
}
- ret = virXPathULong(conn, "string(./miimon/@updelay)", ctxt, &tmp);
+ ret = virXPathULong("string(./miimon/@updelay)", ctxt, &tmp);
if (ret == -2) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface miimon updelay invalid"));
goto error;
}
- } else if ((node = virXPathNode(conn, "./arpmon[1]", ctxt)) != NULL) {
+ } else if ((node = virXPathNode("./arpmon[1]", ctxt)) != NULL) {
def->data.bond.monit = VIR_INTERFACE_BOND_MONIT_ARP;
- ret = virXPathULong(conn, "string(./arpmon/@interval)", ctxt, &tmp);
+ ret = virXPathULong("string(./arpmon/@interval)", ctxt, &tmp);
if ((ret == -2) || (ret == -1)) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface arpmon interval missing or invalid"));
def->data.bond.interval = (int) tmp;
def->data.bond.target =
- virXPathString(conn, "string(./arpmon/@target)", ctxt);
+ virXPathString("string(./arpmon/@target)", ctxt);
if (def->data.bond.target == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface arpmon target missing"));
static int
virInterfaceDefParseVlan(virConnectPtr conn, virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) {
- def->data.vlan.tag = virXPathString(conn, "string(./@tag)", ctxt);
+ def->data.vlan.tag = virXPathString("string(./@tag)", ctxt);
if (def->data.vlan.tag == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses the tag attribute"));
}
def->data.vlan.devname =
- virXPathString(conn, "string(./interface/@name)", ctxt);
+ virXPathString("string(./interface/@name)", ctxt);
if (def->data.vlan.devname == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses name attribute"));
xmlNodePtr cur = ctxt->node;
/* check @type */
- tmp = virXPathString(conn, "string(./@type)", ctxt);
+ tmp = virXPathString("string(./@type)", ctxt);
if (tmp == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("interface misses the type attribute"));
case VIR_INTERFACE_TYPE_ETHERNET:
if (virInterfaceDefParseName(conn, def, ctxt) < 0)
goto error;
- tmp = virXPathString(conn, "string(./mac/@address)", ctxt);
+ tmp = virXPathString("string(./mac/@address)", ctxt);
if (tmp != NULL)
def->mac = tmp;
if (parentIfType == VIR_INTERFACE_TYPE_LAST) {
if (virInterfaceDefParseIfAdressing(conn, def, ctxt) < 0)
goto error;
- bridge = virXPathNode(conn, "./bridge[1]", ctxt);
+ bridge = virXPathNode("./bridge[1]", ctxt);
if (bridge == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bridge interface misses the bridge element"));
goto error;
}
- bond = virXPathNode(conn, "./bond[1]", ctxt);
+ bond = virXPathNode("./bond[1]", ctxt);
if (bond == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("bond interface misses the bond element"));
case VIR_INTERFACE_TYPE_VLAN: {
xmlNodePtr vlan;
- tmp = virXPathString(conn, "string(./@name)", ctxt);
+ tmp = virXPathString("string(./@name)", ctxt);
if (tmp != NULL)
def->name = tmp;
if (virInterfaceDefParseStartMode(conn, def, ctxt) < 0)
goto error;
if (virInterfaceDefParseIfAdressing(conn, def, ctxt) < 0)
goto error;
- vlan = virXPathNode(conn, "./vlan[1]", ctxt);
+ vlan = virXPathNode("./vlan[1]", ctxt);
if (vlan == NULL) {
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses the vlan element"));
}
/* Extract network name */
- def->name = virXPathString(conn, "string(./name[1])", ctxt);
+ def->name = virXPathString("string(./name[1])", ctxt);
if (!def->name) {
virNetworkReportError(conn, VIR_ERR_NO_NAME, NULL);
goto error;
}
/* Extract network uuid */
- tmp = virXPathString(conn, "string(./uuid[1])", ctxt);
+ tmp = virXPathString("string(./uuid[1])", ctxt);
if (!tmp) {
if (virUUIDGenerate(def->uuid)) {
virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
/* Parse network domain information */
- def->domain = virXPathString(conn, "string(./domain[1]/@name)", ctxt);
+ def->domain = virXPathString("string(./domain[1]/@name)", ctxt);
/* Parse bridge information */
- def->bridge = virXPathString(conn, "string(./bridge[1]/@name)", ctxt);
- tmp = virXPathString(conn, "string(./bridge[1]/@stp)", ctxt);
+ def->bridge = virXPathString("string(./bridge[1]/@name)", ctxt);
+ tmp = virXPathString("string(./bridge[1]/@stp)", ctxt);
def->stp = (tmp && STREQ(tmp, "off")) ? 0 : 1;
VIR_FREE(tmp);
- if (virXPathULong(conn, "string(./bridge[1]/@delay)", ctxt, &def->delay) < 0)
+ if (virXPathULong("string(./bridge[1]/@delay)", ctxt, &def->delay) < 0)
def->delay = 0;
- def->ipAddress = virXPathString(conn, "string(./ip[1]/@address)", ctxt);
- def->netmask = virXPathString(conn, "string(./ip[1]/@netmask)", ctxt);
+ def->ipAddress = virXPathString("string(./ip[1]/@address)", ctxt);
+ def->netmask = virXPathString("string(./ip[1]/@netmask)", ctxt);
if (def->ipAddress &&
def->netmask) {
/* XXX someday we want IPv6 too, so inet_aton won't work there */
goto error;
}
- if ((ip = virXPathNode(conn, "./ip[1]", ctxt)) &&
+ if ((ip = virXPathNode("./ip[1]", ctxt)) &&
virNetworkIPParseXML(conn, def, ip) < 0)
goto error;
}
/* IPv4 forwarding setup */
- if (virXPathBoolean(conn, "count(./forward) > 0", ctxt)) {
+ if (virXPathBoolean("count(./forward) > 0", ctxt)) {
if (!def->ipAddress ||
!def->netmask) {
virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
goto error;
}
- tmp = virXPathString(conn, "string(./forward[1]/@mode)", ctxt);
+ tmp = virXPathString("string(./forward[1]/@mode)", ctxt);
if (tmp) {
if ((def->forwardType = virNetworkForwardTypeFromString(tmp)) < 0) {
virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
- def->forwardDev = virXPathString(conn, "string(./forward[1]/@dev)", ctxt);
+ def->forwardDev = virXPathString("string(./forward[1]/@dev)", ctxt);
} else {
def->forwardType = VIR_NETWORK_FORWARD_NONE;
}
{
char *s;
- s = virXPathString(conn, xpath, ctxt);
+ s = virXPathString(xpath, ctxt);
if (s == NULL) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
missing_error_fmt,
int ret;
unsigned long val;
- ret = virXPathULong(conn, xpath, ctxt, &val);
+ ret = virXPathULong(xpath, ctxt, &val);
if (ret < 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
int ret;
unsigned long long val;
- ret = virXPathULongLong(conn, xpath, ctxt, &val);
+ ret = virXPathULongLong(xpath, ctxt, &val);
if (ret < 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
orignode = ctxt->node;
ctxt->node = node;
- data->storage.block = virXPathString(conn, "string(./block[1])", ctxt);
+ data->storage.block = virXPathString("string(./block[1])", ctxt);
if (!data->storage.block) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no block device path supplied for '%s'"),
goto out;
}
- data->storage.bus = virXPathString(conn, "string(./bus[1])", ctxt);
- data->storage.drive_type = virXPathString(conn, "string(./drive_type[1])", ctxt);
- data->storage.model = virXPathString(conn, "string(./model[1])", ctxt);
- data->storage.vendor = virXPathString(conn, "string(./vendor[1])", ctxt);
- data->storage.serial = virXPathString(conn, "string(./serial[1])", ctxt);
+ data->storage.bus = virXPathString("string(./bus[1])", ctxt);
+ data->storage.drive_type = virXPathString("string(./drive_type[1])", ctxt);
+ data->storage.model = virXPathString("string(./model[1])", ctxt);
+ data->storage.vendor = virXPathString("string(./vendor[1])", ctxt);
+ data->storage.serial = virXPathString("string(./serial[1])", ctxt);
- if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("error parsing storage capabilities for '%s'"),
def->name);
orignode2 = ctxt->node;
ctxt->node = nodes[i];
- if (virXPathBoolean(conn, "count(./media_available[. = '1']) > 0", ctxt))
+ if (virXPathBoolean("count(./media_available[. = '1']) > 0", ctxt))
data->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
- data->storage.media_label = virXPathString(conn, "string(./media_label[1])", ctxt);
+ data->storage.media_label = virXPathString("string(./media_label[1])", ctxt);
val = 0;
if (virNodeDevCapsDefParseULongLong(conn, "number(./media_size[1])", ctxt, &val, def,
_("invalid SCSI LUN ID supplied for '%s'")) < 0)
goto out;
- data->scsi.type = virXPathString(conn, "string(./type[1])", ctxt);
+ data->scsi.type = virXPathString("string(./type[1])", ctxt);
ret = 0;
out:
orignode = ctxt->node;
ctxt->node = node;
- data->scsi_target.name = virXPathString(conn, "string(./name[1])", ctxt);
+ data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
if (!data->scsi_target.name) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no target name supplied for '%s'"),
goto out;
}
- if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) < 0) {
+ if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("error parsing SCSI host capabilities for '%s'"),
def->name);
orignode = ctxt->node;
ctxt->node = node;
- data->net.ifname = virXPathString(conn, "string(./interface[1])", ctxt);
+ data->net.ifname = virXPathString("string(./interface[1])", ctxt);
if (!data->net.ifname) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no network interface supplied for '%s'"),
goto out;
}
- data->net.address = virXPathString(conn, "string(./address[1])", ctxt);
+ data->net.address = virXPathString("string(./address[1])", ctxt);
data->net.subtype = VIR_NODE_DEV_CAP_NET_LAST;
- tmp = virXPathString(conn, "string(./capability/@type)", ctxt);
+ tmp = virXPathString("string(./capability/@type)", ctxt);
if (tmp) {
int val = virNodeDevNetCapTypeFromString(tmp);
VIR_FREE(tmp);
_("invalid USB interface protocol supplied for '%s'")) < 0)
goto out;
- data->usb_if.description = virXPathString(conn, "string(./description[1])", ctxt);
+ data->usb_if.description = virXPathString("string(./description[1])", ctxt);
ret = 0;
out:
int ret;
unsigned long val;
- ret = virXPathULongHex(conn, xpath, ctxt, &val);
+ ret = virXPathULongHex(xpath, ctxt, &val);
if (ret < 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
ret == -1 ? missing_error_fmt : invalid_error_fmt,
_("invalid USB product ID supplied for '%s'")) < 0)
goto out;
- data->usb_dev.vendor_name = virXPathString(conn, "string(./vendor[1])", ctxt);
- data->usb_dev.product_name = virXPathString(conn, "string(./product[1])", ctxt);
+ data->usb_dev.vendor_name = virXPathString("string(./vendor[1])", ctxt);
+ data->usb_dev.product_name = virXPathString("string(./product[1])", ctxt);
ret = 0;
out:
_("invalid PCI product ID supplied for '%s'")) < 0)
goto out;
- data->pci_dev.vendor_name = virXPathString(conn, "string(./vendor[1])", ctxt);
- data->pci_dev.product_name = virXPathString(conn, "string(./product[1])", ctxt);
+ data->pci_dev.vendor_name = virXPathString("string(./vendor[1])", ctxt);
+ data->pci_dev.product_name = virXPathString("string(./product[1])", ctxt);
ret = 0;
out:
orignode = ctxt->node;
ctxt->node = node;
- data->system.product_name = virXPathString(conn, "string(./product[1])", ctxt);
+ data->system.product_name = virXPathString("string(./product[1])", ctxt);
- data->system.hardware.vendor_name = virXPathString(conn, "string(./hardware/vendor[1])", ctxt);
- data->system.hardware.version = virXPathString(conn, "string(./hardware/version[1])", ctxt);
- data->system.hardware.serial = virXPathString(conn, "string(./hardware/serial[1])", ctxt);
+ data->system.hardware.vendor_name = virXPathString("string(./hardware/vendor[1])", ctxt);
+ data->system.hardware.version = virXPathString("string(./hardware/version[1])", ctxt);
+ data->system.hardware.serial = virXPathString("string(./hardware/serial[1])", ctxt);
- tmp = virXPathString(conn, "string(./hardware/uuid[1])", ctxt);
+ tmp = virXPathString("string(./hardware/uuid[1])", ctxt);
if (!tmp) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no system UUID supplied for '%s'"), def->name);
}
VIR_FREE(tmp);
- data->system.firmware.vendor_name = virXPathString(conn, "string(./firmware/vendor[1])", ctxt);
- data->system.firmware.version = virXPathString(conn, "string(./firmware/version[1])", ctxt);
- data->system.firmware.release_date = virXPathString(conn, "string(./firmware/release_date[1])", ctxt);
+ data->system.firmware.vendor_name = virXPathString("string(./firmware/vendor[1])", ctxt);
+ data->system.firmware.version = virXPathString("string(./firmware/version[1])", ctxt);
+ data->system.firmware.release_date = virXPathString("string(./firmware/release_date[1])", ctxt);
ret = 0;
out:
/* Extract device name */
if (create == EXISTING_DEVICE) {
- def->name = virXPathString(conn, "string(./name[1])", ctxt);
+ def->name = virXPathString("string(./name[1])", ctxt);
if (!def->name) {
virNodeDeviceReportError(conn, VIR_ERR_NO_NAME, NULL);
}
/* Extract device parent, if any */
- def->parent = virXPathString(conn, "string(./parent[1])", ctxt);
+ def->parent = virXPathString("string(./parent[1])", ctxt);
/* Parse device capabilities */
nodes = NULL;
- if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) <= 0) {
+ if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) <= 0) {
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("no device capabilities for '%s'"),
def->name);
char *type_str;
int type;
- type_str = virXPathString(conn, "string(./usage/@type)", ctxt);
+ type_str = virXPathString("string(./usage/@type)", ctxt);
if (type_str == NULL) {
virSecretReportError(conn, VIR_ERR_XML_ERROR, "%s",
_("unknown secret usage type"));
break;
case VIR_SECRET_USAGE_TYPE_VOLUME:
- def->usage.volume = virXPathString(conn, "string(./usage/volume)",
- ctxt);
+ def->usage.volume = virXPathString("string(./usage/volume)", ctxt);
if (!def->usage.volume) {
virSecretReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("volume usage specified, but volume path is missing"));
goto cleanup;
}
- prop = virXPathString(conn, "string(./@ephemeral)", ctxt);
+ prop = virXPathString("string(./@ephemeral)", ctxt);
if (prop != NULL) {
if (STREQ(prop, "yes"))
def->ephemeral = 1;
VIR_FREE(prop);
}
- prop = virXPathString(conn, "string(./@private)", ctxt);
+ prop = virXPathString("string(./@private)", ctxt);
if (prop != NULL) {
if (STREQ(prop, "yes"))
def->private = 1;
VIR_FREE(prop);
}
- uuidstr = virXPathString(conn, "string(./uuid)", ctxt);
+ uuidstr = virXPathString("string(./uuid)", ctxt);
if (!uuidstr) {
if (virUUIDGenerate(def->uuid)) {
virSecretReportError(conn, VIR_ERR_INTERNAL_ERROR,
VIR_FREE(uuidstr);
}
- def->description = virXPathString(conn, "string(./description)", ctxt);
- if (virXPathNode(conn, "./usage", ctxt) != NULL
+ def->description = virXPathString("string(./description)", ctxt);
+ if (virXPathNode("./usage", ctxt) != NULL
&& virSecretDefParseUsage(conn, ctxt, def) < 0)
goto cleanup;
ret = def;
virStoragePoolDefParseAuthChap(virConnectPtr conn,
xmlXPathContextPtr ctxt,
virStoragePoolAuthChapPtr auth) {
- auth->login = virXPathString(conn, "string(./auth/@login)", ctxt);
+ auth->login = virXPathString("string(./auth/@login)", ctxt);
if (auth->login == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("missing auth host attribute"));
return -1;
}
- auth->passwd = virXPathString(conn, "string(./auth/@passwd)", ctxt);
+ auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
if (auth->passwd == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("missing auth passwd attribute"));
goto cleanup;
}
- source->name = virXPathString(conn, "string(./name)", ctxt);
+ source->name = virXPathString("string(./name)", ctxt);
if (options->formatFromString) {
- char *format = virXPathString(conn, "string(./format/@type)", ctxt);
+ char *format = virXPathString("string(./format/@type)", ctxt);
if (format == NULL)
source->format = options->defaultFormat;
else
VIR_FREE(format);
}
- source->host.name = virXPathString(conn, "string(./host/@name)", ctxt);
- source->initiator.iqn = virXPathString(conn,
- "string(./initiator/iqn/@name)", ctxt);
+ source->host.name = virXPathString("string(./host/@name)", ctxt);
+ source->initiator.iqn = virXPathString("string(./initiator/iqn/@name)", ctxt);
- nsource = virXPathNodeSet(conn, "./device", ctxt, &nodeset);
+ nsource = virXPathNodeSet("./device", ctxt, &nodeset);
if (nsource > 0) {
if (VIR_ALLOC_N(source->devices, nsource) < 0) {
VIR_FREE(nodeset);
source->ndevice = nsource;
}
- source->dir = virXPathString(conn, "string(./dir/@path)", ctxt);
- source->adapter = virXPathString(conn, "string(./adapter/@name)", ctxt);
+ source->dir = virXPathString("string(./dir/@path)", ctxt);
+ source->adapter = virXPathString("string(./adapter/@name)", ctxt);
- authType = virXPathString(conn, "string(./auth/@type)", ctxt);
+ authType = virXPathString("string(./auth/@type)", ctxt);
if (authType == NULL) {
source->authType = VIR_STORAGE_POOL_AUTH_NONE;
} else {
goto cleanup;
}
- node = virXPathNode(conn, "/source", xpath_ctxt);
+ node = virXPathNode("/source", xpath_ctxt);
if (!node) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("root element was not source"));
xmlNodePtr relnode;
xmlNodePtr node;
- node = virXPathNode(conn, permxpath, ctxt);
+ node = virXPathNode(permxpath, ctxt);
if (node == NULL) {
/* Set default values if there is not <permissions> element */
perms->mode = defaultmode;
relnode = ctxt->node;
ctxt->node = node;
- mode = virXPathString(conn, "string(./mode)", ctxt);
+ mode = virXPathString("string(./mode)", ctxt);
if (!mode) {
perms->mode = defaultmode;
} else {
VIR_FREE(mode);
}
- if (virXPathNode(conn, "./owner", ctxt) == NULL) {
+ if (virXPathNode("./owner", ctxt) == NULL) {
perms->uid = getuid();
} else {
- if (virXPathLong(conn, "number(./owner)", ctxt, &v) < 0) {
+ if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("malformed owner element"));
goto error;
perms->uid = (int)v;
}
- if (virXPathNode(conn, "./group", ctxt) == NULL) {
+ if (virXPathNode("./group", ctxt) == NULL) {
perms->gid = getgid();
} else {
- if (virXPathLong(conn, "number(./group)", ctxt, &v) < 0) {
+ if (virXPathLong("number(./group)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("malformed group element"));
goto error;
}
/* NB, we're ignoring missing labels here - they'll simply inherit */
- perms->label = virXPathString(conn, "string(./label)", ctxt);
+ perms->label = virXPathString("string(./label)", ctxt);
ret = 0;
error:
return NULL;
}
- type = virXPathString(conn, "string(./@type)", ctxt);
+ type = virXPathString("string(./@type)", ctxt);
if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("unknown storage pool type %s"), (const char*)type);
goto cleanup;
}
- source_node = virXPathNode(conn, "./source", ctxt);
+ source_node = virXPathNode("./source", ctxt);
if (source_node) {
if (virStoragePoolDefParseSource(conn, ctxt, &ret->source, ret->type,
source_node) < 0)
goto cleanup;
}
- ret->name = virXPathString(conn, "string(./name)", ctxt);
+ ret->name = virXPathString("string(./name)", ctxt);
if (ret->name == NULL &&
options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
ret->name = ret->source.name;
goto cleanup;
}
- uuid = virXPathString(conn, "string(./uuid)", ctxt);
+ uuid = virXPathString("string(./uuid)", ctxt);
if (uuid == NULL) {
if (virUUIDGenerate(ret->uuid) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
}
}
- if ((ret->target.path = virXPathString(conn, "string(./target/path)", ctxt)) == NULL) {
+ if ((ret->target.path = virXPathString("string(./target/path)", ctxt)) == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("missing storage pool target path"));
goto cleanup;
return NULL;
}
- ret->name = virXPathString(conn, "string(./name)", ctxt);
+ ret->name = virXPathString("string(./name)", ctxt);
if (ret->name == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("missing volume name element"));
}
/* Auto-generated so deliberately ignore */
- /*ret->key = virXPathString(conn, "string(./key)", ctxt);*/
+ /*ret->key = virXPathString("string(./key)", ctxt);*/
- capacity = virXPathString(conn, "string(./capacity)", ctxt);
- unit = virXPathString(conn, "string(./capacity/@unit)", ctxt);
+ capacity = virXPathString("string(./capacity)", ctxt);
+ unit = virXPathString("string(./capacity/@unit)", ctxt);
if (capacity == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
"%s", _("missing capacity element"));
VIR_FREE(capacity);
VIR_FREE(unit);
- allocation = virXPathString(conn, "string(./allocation)", ctxt);
+ allocation = virXPathString("string(./allocation)", ctxt);
if (allocation) {
- unit = virXPathString(conn, "string(./allocation/@unit)", ctxt);
+ unit = virXPathString("string(./allocation/@unit)", ctxt);
if (virStorageSize(conn, unit, allocation, &ret->allocation) < 0)
goto cleanup;
VIR_FREE(allocation);
ret->allocation = ret->capacity;
}
- ret->target.path = virXPathString(conn, "string(./target/path)", ctxt);
+ ret->target.path = virXPathString("string(./target/path)", ctxt);
if (options->formatFromString) {
- char *format = virXPathString(conn, "string(./target/format/@type)", ctxt);
+ char *format = virXPathString("string(./target/format/@type)", ctxt);
if (format == NULL)
ret->target.format = options->defaultFormat;
else
"./target/permissions", 0600) < 0)
goto cleanup;
- node = virXPathNode(conn, "./target/encryption", ctxt);
+ node = virXPathNode("./target/encryption", ctxt);
if (node != NULL) {
ret->target.encryption = virStorageEncryptionParseNode(conn, ctxt->doc,
node);
- ret->backingStore.path = virXPathString(conn, "string(./backingStore/path)", ctxt);
+ ret->backingStore.path = virXPathString("string(./backingStore/path)", ctxt);
if (options->formatFromString) {
- char *format = virXPathString(conn, "string(./backingStore/format/@type)", ctxt);
+ char *format = virXPathString("string(./backingStore/format/@type)", ctxt);
if (format == NULL)
ret->backingStore.format = options->defaultFormat;
else
old_node = ctxt->node;
ctxt->node = node;
- type_str = virXPathString(conn, "string(./@type)", ctxt);
+ type_str = virXPathString("string(./@type)", ctxt);
if (type_str == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s",
_("unknown volume encryption secret type"));
VIR_FREE(type_str);
ret->type = type;
- uuidstr = virXPathString(conn, "string(./@uuid)", ctxt);
+ uuidstr = virXPathString("string(./@uuid)", ctxt);
if (uuidstr) {
if (virUUIDParse(uuidstr, ret->uuid) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
return NULL;
}
- format_str = virXPathString(conn, "string(./@format)", ctxt);
+ format_str = virXPathString("string(./@format)", ctxt);
if (format_str == NULL) {
virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s",
_("unknown volume encryption format"));
VIR_FREE(format_str);
ret->format = format;
- n = virXPathNodeSet(conn, "./secret", ctxt, &nodes);
+ n = virXPathNodeSet("./secret", ctxt, &nodes);
if (n < 0){
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot extract volume encryption secrets"));
ctxt->node = xmlDocGetRootElement(xml);
- if ((ctxt->node = virXPathNode(NULL, xpath, ctxt)) == NULL) {
+ if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) {
virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR,
_("cannot find CPU map for %s architecture"), arch);
goto cleanup;
if (VIR_ALLOC(feature) < 0)
goto no_memory;
- feature->name = virXPathString(NULL, "string(@name)", ctxt);
+ feature->name = virXPathString("string(@name)", ctxt);
if (feature->name == NULL) {
virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing CPU feature name"));
goto ignore;
}
- n = virXPathNodeSet(NULL, "./cpuid", ctxt, &nodes);
+ n = virXPathNodeSet("./cpuid", ctxt, &nodes);
if (n < 0)
goto ignore;
ctxt->node = nodes[i];
fun = eax = ebx = ecx = edx = 0;
- ret_fun = virXPathULongHex(NULL, "string(@function)", ctxt, &fun);
- ret_eax = virXPathULongHex(NULL, "string(@eax)", ctxt, &eax);
- ret_ebx = virXPathULongHex(NULL, "string(@ebx)", ctxt, &ebx);
- ret_ecx = virXPathULongHex(NULL, "string(@ecx)", ctxt, &ecx);
- ret_edx = virXPathULongHex(NULL, "string(@edx)", ctxt, &edx);
+ ret_fun = virXPathULongHex("string(@function)", ctxt, &fun);
+ ret_eax = virXPathULongHex("string(@eax)", ctxt, &eax);
+ ret_ebx = virXPathULongHex("string(@ebx)", ctxt, &ebx);
+ ret_ecx = virXPathULongHex("string(@ecx)", ctxt, &ecx);
+ ret_edx = virXPathULongHex("string(@edx)", ctxt, &edx);
if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2
|| ret_ecx == -2 || ret_edx == -2) {
if (VIR_ALLOC(model) < 0)
goto no_memory;
- model->name = virXPathString(NULL, "string(@name)", ctxt);
+ model->name = virXPathString("string(@name)", ctxt);
if (model->name == NULL) {
virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing CPU model name"));
goto ignore;
}
- if (virXPathNode(NULL, "./model", ctxt) != NULL) {
+ if (virXPathNode("./model", ctxt) != NULL) {
const struct x86_model *ancestor;
char *name;
- name = virXPathString(NULL, "string(./model/@name)", ctxt);
+ name = virXPathString("string(./model/@name)", ctxt);
if (name == NULL) {
virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR,
_("Missing ancestor's name in CPU model %s"),
sizeof(*model->cpuid) * model->ncpuid);
}
- n = virXPathNodeSet(NULL, "./feature", ctxt, &nodes);
+ n = virXPathNodeSet("./feature", ctxt, &nodes);
if (n < 0)
goto ignore;
if ((*response)->responseCode == 500) {
(*response)->node =
- virXPathNode(NULL, "/soapenv:Envelope/soapenv:Body/soapenv:Fault",
+ virXPathNode("/soapenv:Envelope/soapenv:Body/soapenv:Fault",
xpathContext);
if ((*response)->node == NULL) {
goto failure;
}
- responseNode = virXPathNode(NULL, xpathExpression, xpathContext);
+ responseNode = virXPathNode(xpathExpression, xpathContext);
if (responseNode == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
}
xpathContext->node = responseNode;
- (*response)->node = virXPathNode(NULL, "./vim:returnval",
- xpathContext);
+ (*response)->node = virXPathNode("./vim:returnval", xpathContext);
switch (occurrence) {
case esxVI_Occurrence_RequiredItem:
}
if (!(monitorpath =
- virXPathString(NULL, "string(./monitor[1]/@path)", ctxt))) {
+ virXPathString("string(./monitor[1]/@path)", ctxt))) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"%s", _("no monitor path"));
goto error;
}
- tmp = virXPathString(NULL, "string(./monitor[1]/@type)", ctxt);
+ tmp = virXPathString("string(./monitor[1]/@type)", ctxt);
if (tmp)
priv->monConfig->type = virDomainChrTypeFromString(tmp);
else
priv->monConfig->type = VIR_DOMAIN_CHR_TYPE_PTY;
VIR_FREE(tmp);
- if (virXPathBoolean(NULL, "count(./monitor[@json = '1']) > 0", ctxt)) {
+ if (virXPathBoolean("count(./monitor[@json = '1']) > 0", ctxt)) {
priv->monJSON = 1;
} else {
priv->monJSON = 0;
goto error;
}
- n = virXPathNodeSet(NULL, "./vcpus/vcpu", ctxt, &nodes);
+ n = virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes);
if (n < 0)
goto error;
if (n) {
}
ctxt->node = root;
- ctl->hvm = virXPathString(NULL, "string(./os/type[1])", ctxt);
+ ctl->hvm = virXPathString("string(./os/type[1])", ctxt);
if (!ctl->hvm || STRNEQ(ctl->hvm, "hvm")) {
vah_error(ctl, 0, "os.type is not 'hvm'");
goto cleanup;
}
- ctl->arch = virXPathString(NULL, "string(./os/type[1]/@arch)", ctxt);
+ ctl->arch = virXPathString("string(./os/type[1]/@arch)", ctxt);
if (!ctl->arch) {
/* The XML we are given should have an arch, but in case it doesn't,
* just use the host's arch.
goto error;
}
- ret = virXPathNodeSet(conn, vol_xpath, ctxt, &vols);
+ ret = virXPathNodeSet(vol_xpath, ctxt, &vols);
VIR_FREE(vol_xpath);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR,
memmove(&privconn->nodeInfo, &defaultNodeInfo, sizeof(defaultNodeInfo));
nodeInfo = &privconn->nodeInfo;
- ret = virXPathLong(conn, "string(/node/cpu/nodes[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/nodes[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->nodes = l;
} else if (ret == -2) {
goto error;
}
- ret = virXPathLong(conn, "string(/node/cpu/sockets[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/sockets[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->sockets = l;
} else if (ret == -2) {
goto error;
}
- ret = virXPathLong(conn, "string(/node/cpu/cores[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/cores[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->cores = l;
} else if (ret == -2) {
goto error;
}
- ret = virXPathLong(conn, "string(/node/cpu/threads[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/threads[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->threads = l;
} else if (ret == -2) {
}
nodeInfo->cpus = nodeInfo->cores * nodeInfo->threads * nodeInfo->sockets * nodeInfo->nodes;
- ret = virXPathLong(conn, "string(/node/cpu/active[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/active[1])", ctxt, &l);
if (ret == 0) {
if (l < nodeInfo->cpus) {
nodeInfo->cpus = l;
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node active cpu"));
goto error;
}
- ret = virXPathLong(conn, "string(/node/cpu/mhz[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/cpu/mhz[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->mhz = l;
} else if (ret == -2) {
goto error;
}
- str = virXPathString(conn, "string(/node/cpu/model[1])", ctxt);
+ str = virXPathString("string(/node/cpu/model[1])", ctxt);
if (str != NULL) {
if (virStrcpyStatic(nodeInfo->model, str) == NULL) {
testError(NULL, VIR_ERR_INTERNAL_ERROR,
VIR_FREE(str);
}
- ret = virXPathLong(conn, "string(/node/memory[1])", ctxt, &l);
+ ret = virXPathLong("string(/node/memory[1])", ctxt, &l);
if (ret == 0) {
nodeInfo->memory = l;
} else if (ret == -2) {
goto error;
}
- ret = virXPathNodeSet(conn, "/node/domain", ctxt, &domains);
+ ret = virXPathNodeSet("/node/domain", ctxt, &domains);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node domain list"));
goto error;
}
VIR_FREE(domains);
- ret = virXPathNodeSet(conn, "/node/network", ctxt, &networks);
+ ret = virXPathNodeSet("/node/network", ctxt, &networks);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node network list"));
goto error;
VIR_FREE(networks);
/* Parse interface definitions */
- ret = virXPathNodeSet(conn, "/node/interface", ctxt, &ifaces);
+ ret = virXPathNodeSet("/node/interface", ctxt, &ifaces);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node interface list"));
goto error;
VIR_FREE(ifaces);
/* Parse Storage Pool list */
- ret = virXPathNodeSet(conn, "/node/pool", ctxt, &pools);
+ ret = virXPathNodeSet("/node/pool", ctxt, &pools);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node pool list"));
goto error;
}
VIR_FREE(pools);
- ret = virXPathNodeSet(conn, "/node/device", ctxt, &devs);
+ ret = virXPathNodeSet("/node/device", ctxt, &devs);
if (ret < 0) {
testError(NULL, VIR_ERR_XML_ERROR, "%s", _("node device list"));
goto error;
#define VIR_FROM_THIS VIR_FROM_XML
-#define virXMLError(conn, code, fmt...) \
- virReportErrorHelper(conn, VIR_FROM_XML, code, __FILE__, \
- __FUNCTION__, __LINE__, fmt)
+#define virXMLError(code, fmt...) \
+ virReportErrorHelper(NULL, VIR_FROM_XML, code, __FILE__, \
+ __FUNCTION__, __LINE__, fmt)
/************************************************************************
* if the evaluation failed.
*/
char *
-virXPathString(virConnectPtr conn,
- const char *xpath,
+virXPathString(const char *xpath,
xmlXPathContextPtr ctxt)
{
xmlXPathObjectPtr obj;
char *ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathString()"));
return (NULL);
}
* the evaluation failed.
*/
char *
-virXPathStringLimit(virConnectPtr conn,
- const char *xpath,
+virXPathStringLimit(const char *xpath,
size_t maxlen,
xmlXPathContextPtr ctxt)
{
- char *tmp = virXPathString(conn, xpath, ctxt);
+ char *tmp = virXPathString(xpath, ctxt);
if (tmp != NULL && strlen(tmp) >= maxlen) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
_("\'%s\' value longer than %Zd bytes in virXPathStringLimit()"),
xpath, maxlen);
return NULL;
* or -1 if the evaluation failed.
*/
int
-virXPathNumber(virConnectPtr conn,
- const char *xpath,
+virXPathNumber(const char *xpath,
xmlXPathContextPtr ctxt,
double *value)
{
xmlNodePtr relnode;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNumber()"));
return (-1);
}
}
static int
-virXPathLongBase(virConnectPtr conn,
- const char *xpath,
+virXPathLongBase(const char *xpath,
xmlXPathContextPtr ctxt,
int base,
long *value)
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathLong()"));
return (-1);
}
* value doesn't have a long format.
*/
int
-virXPathLong(virConnectPtr conn,
- const char *xpath,
+virXPathLong(const char *xpath,
xmlXPathContextPtr ctxt,
long *value)
{
- return virXPathLongBase(conn, xpath, ctxt, 10, value);
+ return virXPathLongBase(xpath, ctxt, 10, value);
}
/**
* value doesn't have a long format.
*/
int
-virXPathLongHex(virConnectPtr conn,
- const char *xpath,
+virXPathLongHex(const char *xpath,
xmlXPathContextPtr ctxt,
long *value)
{
- return virXPathLongBase(conn, xpath, ctxt, 16, value);
+ return virXPathLongBase(xpath, ctxt, 16, value);
}
static int
-virXPathULongBase(virConnectPtr conn,
- const char *xpath,
+virXPathULongBase(const char *xpath,
xmlXPathContextPtr ctxt,
int base,
unsigned long *value)
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathULong()"));
return (-1);
}
* value doesn't have a long format.
*/
int
-virXPathULong(virConnectPtr conn,
- const char *xpath,
+virXPathULong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long *value)
{
- return virXPathULongBase(conn, xpath, ctxt, 10, value);
+ return virXPathULongBase(xpath, ctxt, 10, value);
}
/**
* value doesn't have a long format.
*/
int
-virXPathULongHex(virConnectPtr conn,
- const char *xpath,
+virXPathULongHex(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long *value)
{
- return virXPathULongBase(conn, xpath, ctxt, 16, value);
+ return virXPathULongBase(xpath, ctxt, 16, value);
}
/**
* value doesn't have a long format.
*/
int
-virXPathULongLong(virConnectPtr conn,
- const char *xpath,
+virXPathULongLong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long long *value)
{
int ret = 0;
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathULong()"));
return (-1);
}
* Returns 0 if false, 1 if true, or -1 if the evaluation failed.
*/
int
-virXPathBoolean(virConnectPtr conn,
- const char *xpath,
+virXPathBoolean(const char *xpath,
xmlXPathContextPtr ctxt)
{
xmlXPathObjectPtr obj;
int ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathBoolean()"));
return (-1);
}
* Returns a pointer to the node or NULL if the evaluation failed.
*/
xmlNodePtr
-virXPathNode(virConnectPtr conn,
- const char *xpath,
+virXPathNode(const char *xpath,
xmlXPathContextPtr ctxt)
{
xmlXPathObjectPtr obj;
xmlNodePtr ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNode()"));
return (NULL);
}
* must be freed) or -1 if the evaluation failed.
*/
int
-virXPathNodeSet(virConnectPtr conn,
- const char *xpath,
+virXPathNodeSet(const char *xpath,
xmlXPathContextPtr ctxt,
xmlNodePtr **list)
{
int ret;
if ((ctxt == NULL) || (xpath == NULL)) {
- virXMLError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNodeSet()"));
return (-1);
}
#include <libxml/tree.h>
#include <libxml/xpath.h>
-int virXPathBoolean (virConnectPtr conn,
- const char *xpath,
+int virXPathBoolean(const char *xpath,
xmlXPathContextPtr ctxt);
-char * virXPathString (virConnectPtr conn,
- const char *xpath,
+char * virXPathString(const char *xpath,
xmlXPathContextPtr ctxt);
-char * virXPathStringLimit(virConnectPtr conn,
- const char *xpath,
- size_t maxlen,
- xmlXPathContextPtr ctxt);
-int virXPathNumber (virConnectPtr conn,
- const char *xpath,
+char * virXPathStringLimit(const char *xpath,
+ size_t maxlen,
+ xmlXPathContextPtr ctxt);
+int virXPathNumber(const char *xpath,
xmlXPathContextPtr ctxt,
double *value);
-int virXPathLong (virConnectPtr conn,
- const char *xpath,
+int virXPathLong(const char *xpath,
xmlXPathContextPtr ctxt,
long *value);
-int virXPathULong (virConnectPtr conn,
- const char *xpath,
+int virXPathULong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long *value);
-int virXPathULongLong(virConnectPtr conn,
- const char *xpath,
+int virXPathULongLong(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long long *value);
-int virXPathLongHex (virConnectPtr conn,
- const char *xpath,
+int virXPathLongHex(const char *xpath,
xmlXPathContextPtr ctxt,
long *value);
-int virXPathULongHex(virConnectPtr conn,
- const char *xpath,
+int virXPathULongHex(const char *xpath,
xmlXPathContextPtr ctxt,
unsigned long *value);
-xmlNodePtr virXPathNode (virConnectPtr conn,
- const char *xpath,
+xmlNodePtr virXPathNode(const char *xpath,
xmlXPathContextPtr ctxt);
-int virXPathNodeSet (virConnectPtr conn,
- const char *xpath,
+int virXPathNodeSet(const char *xpath,
xmlXPathContextPtr ctxt,
xmlNodePtr **list);
-
char * virXMLPropString(xmlNodePtr node,
const char *name);