#define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
"remoteReadConfigFile: %s: %s: expected type " #typ "\n", \
filename, (name)); \
virConfFree(conf); \
if (p)
p = strndup(help, p - help);
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse QEMU version number in '%s'"),
- p ? p : help);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse QEMU version number in '%s'"),
+ p ? p : help);
VIR_FREE(p);
return -1;
}
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Network type %d is not supported"), net->type);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Network type %d is not supported"), net->type);
return -1;
}
&net->ifname, vnet_hdr, &tapfd))) {
if (errno == ENOTSUP) {
/* In this particular case, give a better diagnostic. */
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Failed to add tap interface to bridge. "
- "%s is not a bridge device"), brname);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to add tap interface to bridge. "
+ "%s is not a bridge device"), brname);
} else if (template_ifname) {
virReportSystemError(err,
_("Failed to add tap interface to bridge '%s'"),
char *devname;
if (virDiskNameToBusDeviceIndex(disk, &busid, &devid) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot convert disk '%s' to bus/device index"),
- disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot convert disk '%s' to bus/device index"),
+ disk->dst);
return -1;
}
ret = virAsprintf(&devname, "xenblk%d", devid);
break;
default:
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- _("Unsupported disk name mapping for bus '%s'"),
- virDomainDiskBusTypeToString(disk->bus));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("Unsupported disk name mapping for bus '%s'"),
+ virDomainDiskBusTypeToString(disk->bus));
return -1;
}
for (i = 0 ; i < def->nnets ; i++) {
int thisidx;
if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info, "net")) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine device index for network device"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine device index for network device"));
return -1;
}
if (thisidx >= idx)
for (i = 0 ; i < def->nhostdevs ; i++) {
int thisidx;
if ((thisidx = qemuDomainDeviceAliasIndex(&def->hostdevs[i]->info, "hostdev")) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to determine device index for hostdevwork device"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to determine device index for hostdevwork device"));
return -1;
}
if (thisidx >= idx)
if (dev->addr.pci.domain != 0 ||
dev->addr.pci.bus != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only PCI domain 0 and bus 0 are available"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only PCI domain 0 and bus 0 are available"));
return NULL;
}
VIR_DEBUG("Reserving PCI addr %s", addr);
if (virHashLookup(addrs->used, addr)) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unable to reserve PCI address %s"), addr);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to reserve PCI address %s"), addr);
VIR_FREE(addr);
return -1;
}
return 0;
}
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("No more available PCI addresses"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("No more available PCI addresses"));
return -1;
}
def->videos[i]->info.addr.pci.bus != 0 ||
def->videos[i]->info.addr.pci.slot != 2 ||
def->videos[i]->info.addr.pci.function != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Primary video card must have PCI address 0:0:2.0"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Primary video card must have PCI address 0:0:2.0"));
goto error;
}
} else {
def->videos[i]->info.addr.pci.bus != 0 ||
def->videos[i]->info.addr.pci.slot != 2 ||
def->videos[i]->info.addr.pci.function != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Primary IDE controller must have PCI address 0:0:1.1"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Primary IDE controller must have PCI address 0:0:1.1"));
goto error;
}
} else {
{
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
if (info->addr.pci.domain != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only PCI device addresses with domain=0 are supported"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only PCI device addresses with domain=0 are supported"));
return -1;
}
if (info->addr.pci.bus != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only PCI device addresses with bus=0 are supported"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only PCI device addresses with bus=0 are supported"));
return -1;
}
if (info->addr.pci.function != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only PCI device addresses with function=0 are supported"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only PCI device addresses with function=0 are supported"));
return -1;
}
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
static int
-qemuSafeSerialParamValue(virConnectPtr conn,
- const char *value)
+qemuSafeSerialParamValue(const char *value)
{
if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen (value)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("driver serial '%s' contains unsafe characters"),
- value);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("driver serial '%s' contains unsafe characters"),
+ value);
return -1;
}
int busid = -1, unitid = -1;
if (idx < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk type '%s'"), disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk type '%s'"), disk->dst);
goto error;
}
switch (disk->bus) {
case VIR_DOMAIN_DISK_BUS_SCSI:
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("unexpected address type for scsi disk"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unexpected address type for scsi disk"));
goto error;
}
* to be created. Yes this is slightly odd. It is not possible
* to have > 1 bus on a SCSI controller (yet). */
if (disk->info.addr.drive.bus != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("SCSI controller only supports 1 bus"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("SCSI controller only supports 1 bus"));
goto error;
}
busid = disk->info.addr.drive.controller;
case VIR_DOMAIN_DISK_BUS_IDE:
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("unexpected address type for ide disk"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unexpected address type for ide disk"));
goto error;
}
/* We can only have 1 IDE controller (currently) */
if (disk->info.addr.drive.controller != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Only 1 %s controller is supported"), bus);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Only 1 %s controller is supported"), bus);
goto error;
}
busid = disk->info.addr.drive.bus;
case VIR_DOMAIN_DISK_BUS_FDC:
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("unexpected address type for fdc disk"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unexpected address type for fdc disk"));
goto error;
}
/* We can only have 1 FDC controller (currently) */
if (disk->info.addr.drive.controller != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Only 1 %s controller is supported"), bus);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Only 1 %s controller is supported"), bus);
goto error;
}
/* We can only have 1 FDC bus (currently) */
if (disk->info.addr.drive.bus != 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Only 1 %s bus is supported"), bus);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Only 1 %s bus is supported"), bus);
goto error;
}
unitid = disk->info.addr.drive.unit;
/* QEMU only supports magic FAT format for now */
if (disk->driverType &&
STRNEQ(disk->driverType, "fat")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk driver type for '%s'"),
- disk->driverType);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk driver type for '%s'"),
+ disk->driverType);
goto error;
}
if (!disk->readonly) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot create virtual FAT disks in read-write mode"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot create virtual FAT disks in read-write mode"));
goto error;
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
virBufferVSprintf(&opt, ",format=%s", disk->driverType);
if (disk->serial &&
(qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_SERIAL)) {
- if (qemuSafeSerialParamValue(NULL, disk->serial) < 0)
+ if (qemuSafeSerialParamValue(disk->serial) < 0)
goto error;
virBufferVSprintf(&opt, ",serial=%s", disk->serial);
}
char *
-qemuBuildDriveDevStr(virConnectPtr conn,
- virDomainDiskDefPtr disk)
+qemuBuildDriveDevStr(virDomainDiskDefPtr disk)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
int idx = virDiskNameToIndex(disk->dst);
if (idx < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk type '%s'"), disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk type '%s'"), disk->dst);
goto error;
}
virBufferAddLit(&opt, "usb-storage");
break;
default:
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk bus '%s' with device setup"), bus);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk bus '%s' with device setup"), bus);
goto error;
}
virBufferVSprintf(&opt, ",drive=drive-%s", disk->info.alias);
char *
-qemuBuildNicStr(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- virDomainNetDefPtr net,
+qemuBuildNicStr(virDomainNetDefPtr net,
const char *prefix,
int vlan)
{
char *
-qemuBuildHostNetStr(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- virDomainNetDefPtr net,
+qemuBuildHostNetStr(virDomainNetDefPtr net,
char type_sep,
int vlan,
const char *tapfd)
const char *model = virDomainWatchdogModelTypeToString(dev->model);
if (!model) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("missing watchdog model"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing watchdog model"));
goto error;
}
const char *model = virDomainSoundModelTypeToString(sound->model);
if (!model) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("invalid sound model"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("invalid sound model"));
goto error;
}
if (!dev->source.subsys.u.usb.bus &&
!dev->source.subsys.u.usb.device) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("USB host device is missing bus/device information"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("USB host device is missing bus/device information"));
return NULL;
}
if (!dev->source.subsys.u.usb.bus &&
!dev->source.subsys.u.usb.device) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("USB host device is missing bus/device information"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("USB host device is missing bus/device information"));
return NULL;
}
static int
-qemuBuildCpuArgStr(virConnectPtr conn,
- const struct qemud_driver *driver,
+qemuBuildCpuArgStr(const struct qemud_driver *driver,
const virDomainDefPtr def,
const char *emulator,
const struct utsname *ut,
if (ncpus > 0 && host) {
virCPUCompareResult cmp;
- cmp = cpuGuestData(conn, host, def->cpu, &data);
+ cmp = cpuGuestData(NULL, host, def->cpu, &data);
switch (cmp) {
case VIR_CPU_COMPARE_INCOMPATIBLE:
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("guest CPU is not compatible with host CPU"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("guest CPU is not compatible with host CPU"));
/* fall through */
case VIR_CPU_COMPARE_ERROR:
goto cleanup;
if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine)))
goto no_memory;
- if (cpuDecode(conn, guest, data, ncpus, cpus) < 0)
+ if (cpuDecode(NULL, guest, data, ncpus, cpus) < 0)
goto cleanup;
virBufferVSprintf(&buf, "%s", guest->model);
cleanup:
virCPUDefFree(guest);
- cpuDataFree(conn, ut->machine, data);
+ cpuDataFree(NULL, ut->machine, data);
if (cpus) {
for (i = 0; i < ncpus; i++)
/*
* Constructs a argv suitable for launching qemu with config defined
* for a given virtual machine.
+ *
+ * XXX 'conn' is only required to resolve network -> bridge name
+ * figure out how to remove this requirement some day
*/
int qemudBuildCommandLine(virConnectPtr conn,
struct qemud_driver *driver,
if (migrateFrom) {
if (STRPREFIX(migrateFrom, "tcp")) {
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("TCP migration is not supported with this QEMU binary"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("TCP migration is not supported with this QEMU binary"));
return -1;
}
} else if (STREQ(migrateFrom, "stdio")) {
if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC) {
migrateFrom = "exec:cat";
} else if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("STDIO migration is not supported with this QEMU binary"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("STDIO migration is not supported with this QEMU binary"));
return -1;
}
} else if (STRPREFIX(migrateFrom, "exec")) {
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("STDIO migration is not supported with this QEMU binary"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("STDIO migration is not supported with this QEMU binary"));
return -1;
}
}
ADD_ARG_LIT(def->os.machine);
}
- if (qemuBuildCpuArgStr(conn, driver, def, emulator, &ut, &cpu) < 0)
+ if (qemuBuildCpuArgStr(driver, def, emulator, &ut, &cpu) < 0)
goto error;
if (cpu) {
ADD_ARG_LIT(memory);
if (def->hugepage_backed) {
if (!driver->hugetlbfs_mount) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("hugetlbfs filesystem is not mounted"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("hugetlbfs filesystem is not mounted"));
goto error;
}
if (!driver->hugepage_path) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("hugepages are disabled by administrator config"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("hugepages are disabled by administrator config"));
goto error;
}
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MEM_PATH)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("hugepage backing not supported by '%s'"),
- def->emulator);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("hugepage backing not supported by '%s'"),
+ def->emulator);
goto error;
}
ADD_ARG_LIT("-mem-prealloc");
ADD_ARG_LIT("-xen-domid");
ADD_ARG_LIT(domid);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("qemu emulator '%s' does not support xen"),
- def->emulator);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("qemu emulator '%s' does not support xen"),
+ def->emulator);
goto error;
}
}
if (disk->driverName != NULL &&
!STREQ(disk->driverName, "qemu")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported driver name '%s' for disk '%s'"),
- disk->driverName, disk->src);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported driver name '%s' for disk '%s'"),
+ disk->driverName, disk->src);
goto error;
}
}
/* QEMU doesn't implement a SATA driver */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("SATA is not supported with this QEMU binary"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("SATA is not supported with this QEMU binary"));
goto error;
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
ADD_USBDISK(disk->src);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported usb disk type for '%s'"), disk->src);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported usb disk type for '%s'"), disk->src);
goto error;
}
continue;
} else {
ADD_ARG_LIT("-device");
- if (!(optstr = qemuBuildDriveDevStr(conn, disk)))
+ if (!(optstr = qemuBuildDriveDevStr(disk)))
goto error;
ADD_ARG(optstr);
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
ADD_USBDISK(disk->src);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported usb disk type for '%s'"), disk->src);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported usb disk type for '%s'"), disk->src);
goto error;
}
continue;
STRPREFIX(disk->dst, "fd")) {
snprintf(dev, NAME_MAX, "-%s", disk->dst);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk type '%s'"), disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk type '%s'"), disk->dst);
goto error;
}
}
/* QEMU only supports magic FAT format for now */
if (disk->driverType &&
STRNEQ(disk->driverType, "fat")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk driver type for '%s'"),
- disk->driverType);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk driver type for '%s'"),
+ disk->driverType);
goto error;
}
if (!disk->readonly) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot create virtual FAT disks in read-write mode"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot create virtual FAT disks in read-write mode"));
goto error;
}
if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
if ((qemuCmdFlags & QEMUD_CMD_FLAG_NETDEV) &&
(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
ADD_ARG_LIT("-netdev");
- if (!(host = qemuBuildHostNetStr(conn, net, ',',
+ if (!(host = qemuBuildHostNetStr(net, ',',
vlan, tapfd_name)))
goto error;
ADD_ARG(host);
ADD_ARG(nic);
} else {
ADD_ARG_LIT("-net");
- if (!(nic = qemuBuildNicStr(conn, net, "nic,", vlan)))
+ if (!(nic = qemuBuildNicStr(net, "nic,", vlan)))
goto error;
ADD_ARG(nic);
}
if (!((qemuCmdFlags & QEMUD_CMD_FLAG_NETDEV) &&
(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE))) {
ADD_ARG_LIT("-net");
- if (!(host = qemuBuildHostNetStr(conn, net, ',',
+ if (!(host = qemuBuildHostNetStr(net, ',',
vlan, tapfd_name)))
goto error;
ADD_ARG(host);
case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD:
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) ||
!(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("guestfwd requires QEMU to support -chardev & -device"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("guestfwd requires QEMU to support -chardev & -device"));
goto error;
}
if (def->nvideos) {
if (def->nvideos > 1) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("only one video card is currently supported"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("only one video card is currently supported"));
goto error;
}
} else {
const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
if (!vgastr || STREQ(vgastr, "")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("video type %s is not supported with QEMU"),
- virDomainVideoTypeToString(def->videos[0]->type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("video type %s is not supported with QEMU"),
+ virDomainVideoTypeToString(def->videos[0]->type));
goto error;
}
break;
default:
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("video type %s is not supported with QEMU"),
- virDomainVideoTypeToString(def->videos[0]->type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("video type %s is not supported with QEMU"),
+ virDomainVideoTypeToString(def->videos[0]->type));
goto error;
}
}
const char *model = virDomainSoundModelTypeToString(sound->model);
if (!model) {
VIR_FREE(modstr);
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("invalid sound model"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("invalid sound model"));
goto error;
}
strncat(modstr, model, size);
const char *model = virDomainWatchdogModelTypeToString(watchdog->model);
if (!model) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("missing watchdog model"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("missing watchdog model"));
goto error;
}
const char *action = virDomainWatchdogActionTypeToString(watchdog->action);
if (!action) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("invalid watchdog action"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("invalid watchdog action"));
goto error;
}
ADD_ARG_LIT("-watchdog-action");
goto error;
ADD_ARG(devstr);
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
- _("PCI device assignment is not supported by this version of qemu"));
+ qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("PCI device assignment is not supported by this version of qemu"));
goto error;
}
}
* NULL is be placed into corresponding place in retvalues.
*/
static int
-qemuParseCommandLineKeywords(virConnectPtr conn,
- const char *str,
+qemuParseCommandLineKeywords(const char *str,
char ***retkeywords,
char ***retvalues,
int allowEmptyValue)
if (separator >= endmark) {
if (!allowEmptyValue) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("malformed keyword arguments in '%s'"), str);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("malformed keyword arguments in '%s'"), str);
goto error;
}
separator = endmark;
* Will fail if not using the 'index' keyword
*/
static virDomainDiskDefPtr
-qemuParseCommandLineDisk(virConnectPtr conn,
- const char *val,
+qemuParseCommandLineDisk(const char *val,
int nvirtiodisk)
{
virDomainDiskDefPtr def = NULL;
int busid = -1;
int unitid = -1;
- if ((nkeywords = qemuParseCommandLineKeywords(conn, val,
+ if ((nkeywords = qemuParseCommandLineKeywords(val,
&keywords,
&values, 0)) < 0)
return NULL;
if (virStrToLong_i(values[i], NULL, 10, &idx) < 0) {
virDomainDiskDefFree(def);
def = NULL;
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse drive index '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse drive index '%s'"), val);
goto cleanup;
}
} else if (STREQ(keywords[i], "bus")) {
if (virStrToLong_i(values[i], NULL, 10, &busid) < 0) {
virDomainDiskDefFree(def);
def = NULL;
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse drive bus '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse drive bus '%s'"), val);
goto cleanup;
}
} else if (STREQ(keywords[i], "unit")) {
if (virStrToLong_i(values[i], NULL, 10, &unitid) < 0) {
virDomainDiskDefFree(def);
def = NULL;
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse drive unit '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse drive unit '%s'"), val);
goto cleanup;
}
}
if (!def->src &&
def->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("missing file parameter in drive '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing file parameter in drive '%s'"), val);
virDomainDiskDefFree(def);
def = NULL;
goto cleanup;
if (idx == -1 &&
unitid == -1 &&
busid == -1) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("missing index/unit/bus parameter in drive '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing index/unit/bus parameter in drive '%s'"), val);
virDomainDiskDefFree(def);
def = NULL;
goto cleanup;
* Tries to find a NIC definition matching a vlan we want
*/
static const char *
-qemuFindNICForVLAN(virConnectPtr conn,
- int nnics,
+qemuFindNICForVLAN(int nnics,
const char **nics,
int wantvlan)
{
tmp += strlen("vlan=");
if (virStrToLong_i(tmp, &end, 10, &gotvlan) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse NIC vlan in '%s'"), nics[i]);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse NIC vlan in '%s'"), nics[i]);
return NULL;
}
if (wantvlan == 0 && nnics > 0)
return nics[0];
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find NIC definition for vlan %d"), wantvlan);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find NIC definition for vlan %d"), wantvlan);
return NULL;
}
* match up against. Horribly complicated stuff
*/
static virDomainNetDefPtr
-qemuParseCommandLineNet(virConnectPtr conn,
- virCapsPtr caps,
+qemuParseCommandLineNet(virCapsPtr caps,
const char *val,
int nnics,
const char **nics)
tmp = strchr(val, ',');
if (tmp) {
- if ((nkeywords = qemuParseCommandLineKeywords(conn,
- tmp+1,
+ if ((nkeywords = qemuParseCommandLineKeywords(tmp+1,
&keywords,
&values, 0)) < 0)
return NULL;
for (i = 0 ; i < nkeywords ; i++) {
if (STREQ(keywords[i], "vlan")) {
if (virStrToLong_i(values[i], NULL, 10, &wantvlan) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse vlan in '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse vlan in '%s'"), val);
virDomainNetDefFree(def);
def = NULL;
goto cleanup;
* frontend, based off vlan number. NB this assumes a 1-1 mapping
*/
- nic = qemuFindNICForVLAN(conn, nnics, nics, wantvlan);
+ nic = qemuFindNICForVLAN(nnics, nics, wantvlan);
if (!nic) {
virDomainNetDefFree(def);
def = NULL;
}
if (!STRPREFIX(nic, "nic")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse NIC definition '%s'"), nic);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse NIC definition '%s'"), nic);
virDomainNetDefFree(def);
def = NULL;
goto cleanup;
VIR_FREE(values);
if (STRPREFIX(nic, "nic,")) {
- if ((nkeywords = qemuParseCommandLineKeywords(conn,
- nic + strlen("nic,"),
+ if ((nkeywords = qemuParseCommandLineKeywords(nic + strlen("nic,"),
&keywords,
&values, 0)) < 0) {
virDomainNetDefFree(def);
if (STREQ(keywords[i], "macaddr")) {
genmac = 0;
if (virParseMacAddr(values[i], def->mac) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unable to parse mac address '%s'"),
- values[i]);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to parse mac address '%s'"),
+ values[i]);
virDomainNetDefFree(def);
def = NULL;
goto cleanup;
* Tries to parse a QEMU PCI device
*/
static virDomainHostdevDefPtr
-qemuParseCommandLinePCI(virConnectPtr conn,
- const char *val)
+qemuParseCommandLinePCI(const char *val)
{
virDomainHostdevDefPtr def = NULL;
int bus = 0, slot = 0, func = 0;
char *end;
if (!STRPREFIX(val, "host=")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown PCI device syntax '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown PCI device syntax '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = val + strlen("host=");
if (virStrToLong_i(start, &end, 16, &bus) < 0 || !end || *end != ':') {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract PCI device bus '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract PCI device bus '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = end + 1;
if (virStrToLong_i(start, &end, 16, &slot) < 0 || !end || *end != '.') {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract PCI device slot '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract PCI device slot '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = end + 1;
if (virStrToLong_i(start, NULL, 16, &func) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract PCI device function '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract PCI device function '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
* Tries to parse a QEMU USB device
*/
static virDomainHostdevDefPtr
-qemuParseCommandLineUSB(virConnectPtr conn,
- const char *val)
+qemuParseCommandLineUSB(const char *val)
{
virDomainHostdevDefPtr def = NULL;
int first = 0, second = 0;
char *end;
if (!STRPREFIX(val, "host:")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown PCI device syntax '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown PCI device syntax '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = val + strlen("host:");
if (strchr(start, ':')) {
if (virStrToLong_i(start, &end, 16, &first) < 0 || !end || *end != ':') {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract USB device vendor '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract USB device vendor '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = end + 1;
if (virStrToLong_i(start, NULL, 16, &second) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract PCI device product '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract PCI device product '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
} else {
if (virStrToLong_i(start, &end, 10, &first) < 0 || !end || *end != '.') {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot extract PCI device bus '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
start = end + 1;
if (virStrToLong_i(start, NULL, 10, &second) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot extract PCI device address '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot extract PCI device address '%s'"), val);
VIR_FREE(def);
goto cleanup;
}
* Tries to parse a QEMU serial/parallel device
*/
static virDomainChrDefPtr
-qemuParseCommandLineChr(virConnectPtr conn,
- const char *val)
+qemuParseCommandLineChr(const char *val)
{
virDomainChrDefPtr def;
}
svc = strchr(val, ':');
if (!svc) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find port number in character device %s"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find port number in character device %s"), val);
goto error;
}
opt = strchr(svc, ',');
if (!def->data.file.path)
goto no_memory;
} else {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown character device syntax %s"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown character device syntax %s"), val);
goto error;
}
static int
-qemuParseCommandLineCPU(virConnectPtr conn,
- virDomainDefPtr dom,
+qemuParseCommandLineCPU(virDomainDefPtr dom,
const char *val)
{
virCPUDefPtr cpu;
else
feature = strdup(p);
- ret = virCPUDefAddFeature(conn, cpu, feature, policy);
+ ret = virCPUDefAddFeature(NULL, cpu, feature, policy);
VIR_FREE(feature);
if (ret < 0)
goto error;
return 0;
syntax:
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown CPU syntax '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown CPU syntax '%s'"), val);
goto error;
no_memory:
static int
-qemuParseCommandLineSmp(virConnectPtr conn,
- virDomainDefPtr dom,
+qemuParseCommandLineSmp(virDomainDefPtr dom,
const char *val)
{
unsigned int sockets = 0;
char *end;
int ret;
- nkws = qemuParseCommandLineKeywords(conn, val, &kws, &vals, 1);
+ nkws = qemuParseCommandLineKeywords(val, &kws, &vals, 1);
if (nkws < 0)
return -1;
return ret;
syntax:
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse CPU topology '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse CPU topology '%s'"), val);
error:
ret = -1;
goto cleanup;
* virDomainDefPtr representing these settings as closely
* as is practical. This is not an exact science....
*/
-virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
const char **progenv,
const char **progargv)
{
int nvirtiodisk = 0;
if (!progargv[0]) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no emulator path found"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("no emulator path found"));
return NULL;
}
#define WANT_VALUE() \
const char *val = progargv[++i]; \
if (!val) { \
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("missing value for %s argument"), arg); \
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("missing value for %s argument"), arg); \
goto error; \
}
char *opts;
if (virStrToLong_i(tmp+1, &opts, 10, &vnc->data.vnc.port) < 0) {
VIR_FREE(vnc);
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("cannot parse VNC port '%s'"), tmp+1);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("cannot parse VNC port '%s'"), tmp+1);
goto error;
}
vnc->data.vnc.listenAddr = strndup(val, tmp-val);
int mem;
WANT_VALUE();
if (virStrToLong_i(val, NULL, 10, &mem) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("cannot parse memory level '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("cannot parse memory level '%s'"), val);
goto error;
}
def->memory = def->maxmem = mem * 1024;
} else if (STREQ(arg, "-smp")) {
WANT_VALUE();
- if (qemuParseCommandLineSmp(conn, def, val) < 0)
+ if (qemuParseCommandLineSmp(def, val) < 0)
goto error;
} else if (STREQ(arg, "-uuid")) {
WANT_VALUE();
if (virUUIDParse(val, def->uuid) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("cannot parse UUID '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("cannot parse UUID '%s'"), val);
goto error;
}
} else if (STRPREFIX(arg, "-hd") ||
WANT_VALUE();
if (STRNEQ(val, "none")) {
virDomainChrDefPtr chr;
- if (!(chr = qemuParseCommandLineChr(conn, val)))
+ if (!(chr = qemuParseCommandLineChr(val)))
goto error;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
virDomainChrDefFree(chr);
WANT_VALUE();
if (STRNEQ(val, "none")) {
virDomainChrDefPtr chr;
- if (!(chr = qemuParseCommandLineChr(conn, val)))
+ if (!(chr = qemuParseCommandLineChr(val)))
goto error;
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
virDomainChrDefFree(chr);
def->disks[def->ndisks++] = disk;
} else {
virDomainHostdevDefPtr hostdev;
- if (!(hostdev = qemuParseCommandLineUSB(conn, val)))
+ if (!(hostdev = qemuParseCommandLineUSB(val)))
goto error;
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
virDomainHostdevDefFree(hostdev);
WANT_VALUE();
if (!STRPREFIX(val, "nic") && STRNEQ(val, "none")) {
virDomainNetDefPtr net;
- if (!(net = qemuParseCommandLineNet(conn, caps, val, nnics, nics)))
+ if (!(net = qemuParseCommandLineNet(caps, val, nnics, nics)))
goto error;
if (VIR_REALLOC_N(def->nets, def->nnets+1) < 0) {
virDomainNetDefFree(net);
} else if (STREQ(arg, "-drive")) {
virDomainDiskDefPtr disk;
WANT_VALUE();
- if (!(disk = qemuParseCommandLineDisk(conn, val, nvirtiodisk)))
+ if (!(disk = qemuParseCommandLineDisk(val, nvirtiodisk)))
goto error;
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
virDomainDiskDefFree(disk);
} else if (STREQ(arg, "-pcidevice")) {
virDomainHostdevDefPtr hostdev;
WANT_VALUE();
- if (!(hostdev = qemuParseCommandLinePCI(conn, val)))
+ if (!(hostdev = qemuParseCommandLinePCI(val)))
goto error;
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
virDomainHostdevDefFree(hostdev);
if (STRNEQ(val, "none")) {
video = qemuVideoTypeFromString(val);
if (video < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown video adapter type '%s'"), val);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown video adapter type '%s'"), val);
goto error;
}
}
} else if (STREQ(arg, "-cpu")) {
WANT_VALUE();
- if (qemuParseCommandLineCPU(conn, def, val) < 0)
+ if (qemuParseCommandLineCPU(def, val) < 0)
goto error;
} else if (STREQ(arg, "-domid")) {
WANT_VALUE();
} else {
VIR_WARN(_("unknown QEMU argument '%s' during conversion"), arg);
#if 0
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown argument '%s'"), arg);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown argument '%s'"), arg);
goto error;
#endif
}
}
-virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
- virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps,
const char *args)
{
const char **progenv = NULL;
if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0)
goto cleanup;
- def = qemuParseCommandLine(conn, caps, progenv, progargv);
+ def = qemuParseCommandLine(caps, progenv, progargv);
cleanup:
for (i = 0 ; progargv && progargv[i] ; i++)
static int qemudDomainGetMaxVcpus(virDomainPtr dom);
-static int qemuDetectVcpuPIDs(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemuDetectVcpuPIDs(struct qemud_driver *driver,
virDomainObjPtr vm);
static int qemuUpdateActivePciHostdevs(struct qemud_driver *driver,
if (!(monitorpath =
virXPathString("string(./monitor[1]/@path)", ctxt))) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no monitor path"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("no monitor path"));
goto error;
}
break;
default:
VIR_FREE(monitorpath);
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unsupported monitor type '%s'"),
- virDomainChrTypeToString(priv->monConfig->type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported monitor type '%s'"),
+ virDomainChrTypeToString(priv->monConfig->type));
goto error;
}
if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
virDomainObjUnref(obj);
if (errno == ETIMEDOUT)
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
- "%s", _("cannot acquire state change lock"));
+ qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
+ "%s", _("cannot acquire state change lock"));
else
virReportSystemError(errno,
"%s", _("cannot acquire job mutex"));
if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
virDomainObjUnref(obj);
if (errno == ETIMEDOUT)
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
- "%s", _("cannot acquire state change lock"));
+ qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
+ "%s", _("cannot acquire state change lock"));
else
virReportSystemError(errno,
"%s", _("cannot acquire job mutex"));
static int
-qemudLogReadFD(virConnectPtr conn, const char* logDir, const char* name, off_t pos)
+qemudLogReadFD(const char* logDir, const char* name, off_t pos)
{
char logfile[PATH_MAX];
mode_t logmode = O_RDONLY;
if ((ret = snprintf(logfile, sizeof(logfile), "%s/%s.log", logDir, name))
< 0 || ret >= sizeof(logfile)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("failed to build logfile name %s/%s.log"),
- logDir, name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to build logfile name %s/%s.log"),
+ logDir, name);
return -1;
}
static virStorageEncryptionPtr
-findDomainDiskEncryption(virConnectPtr conn, virDomainObjPtr vm,
+findDomainDiskEncryption(virDomainObjPtr vm,
const char *path)
{
bool seen_volume;
}
}
if (seen_volume)
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
- _("missing <encryption> for volume %s"), path);
+ qemuReportError(VIR_ERR_INVALID_DOMAIN,
+ _("missing <encryption> for volume %s"), path);
else
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unexpected passphrase request for volume %s"),
- path);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected passphrase request for volume %s"),
+ path);
return NULL;
}
virDomainObjLock(vm);
if (!conn) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cannot find secrets without a connection"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cannot find secrets without a connection"));
goto cleanup;
}
if (conn->secretDriver == NULL ||
conn->secretDriver->lookupByUUID == NULL ||
conn->secretDriver->getValue == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
- _("secret storage not supported"));
+ qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("secret storage not supported"));
goto cleanup;
}
- enc = findDomainDiskEncryption(conn, vm, path);
+ enc = findDomainDiskEncryption(vm, path);
if (enc == NULL)
return -1;
enc->nsecrets != 1 ||
enc->secrets[0]->type !=
VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
- _("invalid <encryption> for volume %s"), path);
+ qemuReportError(VIR_ERR_INVALID_DOMAIN,
+ _("invalid <encryption> for volume %s"), path);
goto cleanup;
}
if (memchr(data, '\0', size) != NULL) {
memset(data, 0, size);
VIR_FREE(data);
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_SECRET,
- _("format='qcow' passphrase for %s must not contain a "
- "'\\0'"), path);
+ qemuReportError(VIR_ERR_INVALID_SECRET,
+ _("format='qcow' passphrase for %s must not contain a "
+ "'\\0'"), path);
goto cleanup;
}
return 0;
}
-typedef int qemuLogHandleOutput(virConnectPtr conn,
- virDomainObjPtr vm,
+typedef int qemuLogHandleOutput(virDomainObjPtr vm,
const char *output,
int fd);
* Returns -1 for error, 0 on success
*/
static int
-qemudReadLogOutput(virConnectPtr conn,
- virDomainObjPtr vm,
+qemudReadLogOutput(virDomainObjPtr vm,
int fd,
char *buf,
size_t buflen,
ssize_t func_ret, ret;
int isdead = 0;
- func_ret = func(conn, vm, buf, fd);
+ func_ret = func(vm, buf, fd);
if (kill(vm->pid, 0) == -1 && errno == ESRCH)
isdead = 1;
got += ret;
buf[got] = '\0';
if (got == buflen-1) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Out of space while reading %s log output"),
- what);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Out of space while reading %s log output"),
+ what);
return -1;
}
if (isdead) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Process exited while reading %s log output"),
- what);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Process exited while reading %s log output"),
+ what);
return -1;
}
retries--;
}
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Timed out while reading %s log output"), what);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Timed out while reading %s log output"), what);
return -1;
}
}
static int
-qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
- virDomainObjPtr vm,
+qemudFindCharDevicePTYsMonitor(virDomainObjPtr vm,
virHashTablePtr paths)
{
int i;
if (chr->data.file.path == NULL) { \
/* neither the log output nor 'info chardev' had a */ \
/* pty path for this chardev, report an error */ \
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
- _("no assigned pty for device %s"), id); \
- return -1; \
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+ _("no assigned pty for device %s"), id); \
+ return -1; \
} else { \
/* 'info chardev' had no pty path for this chardev, */\
/* but the log output had, so we're fine */ \
}
static int
-qemudFindCharDevicePTYs(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- virDomainObjPtr vm,
+qemudFindCharDevicePTYs(virDomainObjPtr vm,
const char *output,
int fd ATTRIBUTE_UNUSED)
{
}
static int
-qemudWaitForMonitor(virConnectPtr conn,
- struct qemud_driver* driver,
+qemudWaitForMonitor(struct qemud_driver* driver,
virDomainObjPtr vm, off_t pos)
{
char buf[4096]; /* Plenty of space to get startup greeting */
int logfd;
int ret = -1;
- if ((logfd = qemudLogReadFD(conn, driver->logDir, vm->def->name, pos))
+ if ((logfd = qemudLogReadFD(driver->logDir, vm->def->name, pos))
< 0)
return -1;
- ret = qemudReadLogOutput(conn, vm, logfd, buf, sizeof(buf),
+ ret = qemudReadLogOutput(vm, logfd, buf, sizeof(buf),
qemudFindCharDevicePTYs,
"console", 3);
if (close(logfd) < 0) {
if (ret < 0) {
/* Unexpected end of file - inform user of QEMU log data */
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unable to start guest: %s"), buf);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to start guest: %s"), buf);
return -1;
}
VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
if (ret == 0) {
- ret = qemudFindCharDevicePTYsMonitor(conn, vm, paths);
+ ret = qemudFindCharDevicePTYsMonitor(vm, paths);
}
cleanup:
}
static int
-qemuDetectVcpuPIDs(virConnectPtr conn,
- struct qemud_driver *driver,
+qemuDetectVcpuPIDs(struct qemud_driver *driver,
virDomainObjPtr vm) {
pid_t *cpupids = NULL;
int ncpupids;
return 0;
if (ncpupids != vm->def->vcpus) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
- ncpupids, (int)vm->def->vcpus);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
+ ncpupids, (int)vm->def->vcpus);
VIR_FREE(cpupids);
return -1;
}
}
static int
-qemudInitCpuAffinity(virConnectPtr conn,
- virDomainObjPtr vm) {
+qemudInitCpuAffinity(virDomainObjPtr vm)
+{
int i, hostcpus, maxcpu = QEMUD_CPUMASK_LEN;
virNodeInfo nodeinfo;
unsigned char *cpumap;
int cpumaplen;
qemuDomainObjPrivatePtr priv = vm->privateData;
- if (nodeGetInfo(conn, &nodeinfo) < 0)
+ if (nodeGetInfo(NULL, &nodeinfo) < 0)
return -1;
/* setaffinity fails if you set bits for CPUs which
if (qemuAssignNextPCIAddress(&(vm->def->disks[i]->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for VirtIO disk %s"),
- vm->def->disks[i]->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for VirtIO disk %s"),
+ vm->def->disks[i]->dst);
return -1;
}
}
if (qemuAssignNextPCIAddress(&(vm->def->nets[i]->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for %s NIC"),
- vm->def->nets[i]->model);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for %s NIC"),
+ vm->def->nets[i]->model);
return -1;
}
}
if (qemuAssignNextPCIAddress(&(vm->def->controllers[i]->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for controller %s"),
- virDomainControllerTypeToString(vm->def->controllers[i]->type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for controller %s"),
+ virDomainControllerTypeToString(vm->def->controllers[i]->type));
return -1;
}
}
if (qemuAssignNextPCIAddress(&(vm->def->videos[i]->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for video adapter %s"),
- virDomainVideoTypeToString(vm->def->videos[i]->type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for video adapter %s"),
+ virDomainVideoTypeToString(vm->def->videos[i]->type));
return -1;
}
}
if (qemuAssignNextPCIAddress(&(vm->def->sounds[i]->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for sound adapter %s"),
- virDomainSoundModelTypeToString(vm->def->sounds[i]->model));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for sound adapter %s"),
+ virDomainSoundModelTypeToString(vm->def->sounds[i]->model));
return -1;
}
}
if (qemuAssignNextPCIAddress(&(vm->def->watchdog->info),
vendor, product,
addrs, naddrs) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find PCI address for watchdog %s"),
- virDomainWatchdogModelTypeToString(vm->def->watchdog->model));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find PCI address for watchdog %s"),
+ virDomainWatchdogModelTypeToString(vm->def->watchdog->model));
return -1;
}
}
}
-static int qemuRemoveCgroup(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemuRemoveCgroup(struct qemud_driver *driver,
virDomainObjPtr vm,
int quiet)
{
rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0);
if (rc != 0) {
if (!quiet)
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to find cgroup for %s\n"),
- vm->def->name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to find cgroup for %s\n"),
+ vm->def->name);
return rc;
}
FD_ZERO(&keepfd);
if (virDomainObjIsActive(vm)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("VM is already active"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("VM is already active"));
return -1;
}
goto cleanup;
/* Ensure no historical cgroup for this VM is lieing around bogus settings */
- qemuRemoveCgroup(conn, driver, vm, 1);
+ qemuRemoveCgroup(driver, vm, 1);
if ((vm->def->ngraphics == 1) &&
vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
vm->def->graphics[0]->data.vnc.autoport) {
int port = qemudNextFreeVNCPort(driver);
if (port < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Unable to find an unused VNC port"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Unable to find an unused VNC port"));
goto cleanup;
}
vm->def->graphics[0]->data.vnc.port = port;
/* wait for qemu process to to show up */
if (ret == 0) {
if (virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Domain %s didn't show up\n"), vm->def->name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Domain %s didn't show up\n"), vm->def->name);
ret = -1;
}
} else if (ret == -2) {
if (ret == -1) /* The VM failed to start */
goto cleanup;
- if (qemudWaitForMonitor(conn, driver, vm, pos) < 0)
+ if (qemudWaitForMonitor(driver, vm, pos) < 0)
goto abort;
- if (qemuDetectVcpuPIDs(conn, driver, vm) < 0)
+ if (qemuDetectVcpuPIDs(driver, vm) < 0)
goto abort;
- if (qemudInitCpuAffinity(conn, vm) < 0)
+ if (qemudInitCpuAffinity(vm) < 0)
goto abort;
if (qemuInitPasswords(driver, vm) < 0)
/* Allow the CPUS to start executing */
if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
if (virGetLastError() == NULL)
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("resume operation failed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("resume operation failed"));
qemuDomainObjExitMonitorWithDriver(driver, vm);
goto abort;
}
if (driver->securityDriver &&
driver->securityDriver->domainReleaseSecurityLabel)
driver->securityDriver->domainReleaseSecurityLabel(conn, vm);
- qemuRemoveCgroup(conn, driver, vm, 0);
+ qemuRemoveCgroup(driver, vm, 0);
if ((vm->def->ngraphics == 1) &&
vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
vm->def->graphics[0]->data.vnc.autoport)
qemuDomainReAttachHostDevices(driver, vm->def);
retry:
- if ((ret = qemuRemoveCgroup(conn, driver, vm, 0)) < 0) {
+ if ((ret = qemuRemoveCgroup(driver, vm, 0)) < 0) {
if (ret == -EBUSY && (retries++ < 5)) {
usleep(200*1000);
goto retry;
return VIR_DRV_OPEN_DECLINED;
if (qemu_driver == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("qemu state driver is not active"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("qemu state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
if (conn->uri->path == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("no QEMU URI path given, try %s"),
- qemu_driver->privileged
- ? "qemu:///system"
- : "qemu:///session");
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("no QEMU URI path given, try %s"),
+ qemu_driver->privileged
+ ? "qemu:///system"
+ : "qemu:///session");
return VIR_DRV_OPEN_ERROR;
}
if (qemu_driver->privileged) {
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unexpected QEMU URI path '%s', try qemu:///system"),
- conn->uri->path);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected QEMU URI path '%s', try qemu:///system"),
+ conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else {
if (STRNEQ (conn->uri->path, "/session")) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unexpected QEMU URI path '%s', try qemu:///session"),
- conn->uri->path);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected QEMU URI path '%s', try qemu:///session"),
+ conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
}
}
-static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
+static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED, const char *type) {
if (!type)
return 16;
if (STRCASEEQ(type, "kqemu"))
return 1;
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
- _("unknown type '%s'"), type);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("unknown type '%s'"), type);
return -1;
}
qemuDriverUnlock(driver);
if (!vm) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching id %d"), id);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching id %d"), id);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(uuid, uuidstr);
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
qemuDriverUnlock(driver);
if (!vm) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching name '%s'"), name);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching name '%s'"), name);
goto cleanup;
}
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
if (!obj) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ qemuReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
qemuDriverUnlock(driver);
if (!obj) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ qemuReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
if (vm->state != VIR_DOMAIN_PAUSED) {
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
if (vm->state == VIR_DOMAIN_PAUSED) {
if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (virGetLastError() == NULL)
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("resume operation failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("resume operation failed"));
goto endjob;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (newmax < vm->def->memory) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set max memory lower than current memory"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("cannot set max memory lower than current memory"));
goto cleanup;;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (newmem > vm->def->maxmem) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set memory higher than max memory"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("cannot set memory higher than max memory"));
goto cleanup;
}
/* Lack of balloon support is a fatal error */
if (r == 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cannot set memory of an active domain"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cannot set memory of an active domain"));
goto endjob;
}
} else {
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
info->cpuTime = 0;
} else {
if (qemudGetProcessInfo(&(info->cpuTime), NULL, vm->pid, 0) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
goto cleanup;
}
}
header.compressed =
qemudSaveCompressionTypeFromString(driver->saveImageFormat);
if (header.compressed < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("Invalid save image format specified "
- "in configuration file"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("Invalid save image format specified "
+ "in configuration file"));
goto cleanup;
}
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
/* Get XML for the domain */
xml = virDomainDefFormat(dom->conn, vm->def, VIR_DOMAIN_XML_SECURE);
if (!xml) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to get domain xml"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to get domain xml"));
goto endjob;
}
header.xml_len = strlen(xml) + 1;
/* Write header to file, followed by XML */
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to create '%s'"), path);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to create '%s'"), path);
goto endjob;
}
if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to write save header"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to write save header"));
goto endjob;
}
if (safewrite(fd, xml, header.xml_len) != header.xml_len) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to write xml"));
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
/* Create an empty file with appropriate ownership. */
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to create '%s'"), path);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to create '%s'"), path);
goto endjob;
}
qemuDomainObjEnterMonitor(vm);
if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
if (virGetLastError() == NULL)
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("resuming after dump failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("resuming after dump failed"));
}
qemuDomainObjExitMonitor(vm);
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot change vcpu count of an active domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot change vcpu count of an active domain"));
goto endjob;
}
if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown virt type in domain definition '%d'"),
- vm->def->virtType);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown virt type in domain definition '%d'"),
+ vm->def->virtType);
goto endjob;
}
- if ((max = qemudGetMaxVCPUs(dom->conn, type)) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not determine max vcpus for the domain"));
+ if ((max = qemudGetMaxVCPUs(NULL, type)) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not determine max vcpus for the domain"));
goto endjob;
}
if (nvcpus > max) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("requested vcpus is greater than max allowable"
- " vcpus for the domain: %d > %d"), nvcpus, max);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("requested vcpus is greater than max allowable"
+ " vcpus for the domain: %d > %d"), nvcpus, max);
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s",_("cannot pin vcpus on an inactive domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s",_("cannot pin vcpus on an inactive domain"));
goto cleanup;
}
priv = vm->privateData;
if (vcpu > (priv->nvcpupids-1)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("vcpu number out of range %d > %d"),
- vcpu, priv->nvcpupids);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("vcpu number out of range %d > %d"),
+ vcpu, priv->nvcpupids);
goto cleanup;
}
cpumap, maplen, maxcpu) < 0)
goto cleanup;
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cpu affinity is not supported"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not supported"));
goto cleanup;
}
ret = 0;
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s",
- _("cannot list vcpu pinning for an inactive domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s",
+ _("cannot list vcpu pinning for an inactive domain"));
goto cleanup;
}
goto cleanup;
}
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cpu affinity is not available"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cpu affinity is not available"));
goto cleanup;
}
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown virt type in domain definition '%d'"),
- vm->def->virtType);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown virt type in domain definition '%d'"),
+ vm->def->virtType);
goto cleanup;
}
- ret = qemudGetMaxVCPUs(dom->conn, type);
+ ret = qemudGetMaxVCPUs(NULL, type);
cleanup:
if (vm)
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unknown virt type in domain definition '%d'"),
- vm->def->virtType);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown virt type in domain definition '%d'"),
+ vm->def->virtType);
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
if (driver->securityDriver && driver->securityDriver->domainGetSecurityProcessLabel) {
if (driver->securityDriver->domainGetSecurityProcessLabel(dom->conn, vm, seclabel) == -1) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Failed to get security label"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Failed to get security label"));
goto cleanup;
}
}
p = driver->caps->host.secModel.model;
if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("security model string exceeds max %d bytes"),
- VIR_SECURITY_MODEL_BUFLEN-1);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security model string exceeds max %d bytes"),
+ VIR_SECURITY_MODEL_BUFLEN-1);
ret = -1;
goto cleanup;
}
p = driver->caps->host.secModel.doi;
if (strlen(p) >= VIR_SECURITY_DOI_BUFLEN-1) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("security DOI string exceeds max %d bytes"),
- VIR_SECURITY_DOI_BUFLEN-1);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("security DOI string exceeds max %d bytes"),
+ VIR_SECURITY_DOI_BUFLEN-1);
ret = -1;
goto cleanup;
}
qemuDriverLock(driver);
/* Verify the header and read the XML */
if ((fd = open(path, O_RDONLY)) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot read domain image"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot read domain image"));
goto cleanup;
}
if (saferead(fd, &header, sizeof(header)) != sizeof(header)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to read qemu header"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to read qemu header"));
goto cleanup;
}
if (memcmp(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic)) != 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("image magic is incorrect"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("image magic is incorrect"));
goto cleanup;
}
if (header.version > QEMUD_SAVE_VERSION) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("image version is not supported (%d > %d)"),
- header.version, QEMUD_SAVE_VERSION);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("image version is not supported (%d > %d)"),
+ header.version, QEMUD_SAVE_VERSION);
goto cleanup;
}
}
if (saferead(fd, xml, header.xml_len) != header.xml_len) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to read XML"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to read XML"));
goto cleanup;
}
/* Create a domain from this XML */
if (!(def = virDomainDefParseString(conn, driver->caps, xml,
VIR_DOMAIN_XML_INACTIVE))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to parse XML"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to parse XML"));
goto cleanup;
}
driver->caps,
&driver->domains,
def))) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to assign new VM"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to assign new VM"));
goto cleanup;
}
def = NULL;
const char *intermediate_argv[3] = { NULL, "-dc", NULL };
const char *prog = qemudSaveCompressionTypeToString(header.compressed);
if (prog == NULL) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("Invalid compressed save format %d"),
- header.compressed);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("Invalid compressed save format %d"),
+ header.compressed);
goto endjob;
}
fd = -1;
if (virExec(intermediate_argv, NULL, NULL,
&intermediate_pid, intermediatefd, &fd, NULL, 0) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Failed to start decompression binary %s"),
- intermediate_argv[0]);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to start decompression binary %s"),
+ intermediate_argv[0]);
goto endjob;
}
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
if (virGetLastError() == NULL)
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to resume domain"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to resume domain"));
qemuDomainObjExitMonitorWithDriver(driver,vm);
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
char *xml = NULL;
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
- _("unsupported config type %s"), format);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported config type %s"), format);
goto cleanup;
}
qemuDriverLock(driver);
- def = qemuParseCommandLineString(conn, driver->caps, config);
+ def = qemuParseCommandLineString(driver->caps, config);
qemuDriverUnlock(driver);
if (!def)
goto cleanup;
qemuDriverLock(driver);
if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
- _("unsupported config type %s"), format);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported config type %s"), format);
goto cleanup;
}
if (qemudExtractVersionInfo(emulator,
NULL,
&qemuCmdFlags) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Cannot determine QEMU argv syntax %s"),
- emulator);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cannot determine QEMU argv syntax %s"),
+ emulator);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is already running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is already running"));
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot delete active domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot delete active domain"));
goto cleanup;
}
if (!vm->persistent) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot undefine transient domain"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot undefine transient domain"));
goto cleanup;
}
}
if (!origdisk) {
- qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("No device with bus '%s' and target '%s'"),
- virDomainDiskBusTypeToString(disk->bus),
- disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No device with bus '%s' and target '%s'"),
+ virDomainDiskBusTypeToString(disk->bus),
+ disk->dst);
return -1;
}
if (!origdisk->info.alias) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("missing disk device alias name for %s"), origdisk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing disk device alias name for %s"), origdisk->dst);
return -1;
}
if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Removable media not supported for %s device"),
- virDomainDiskDeviceTypeToString(disk->device));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Removable media not supported for %s device"),
+ virDomainDiskDeviceTypeToString(disk->device));
return -1;
}
}
-static int qemudDomainAttachPciDiskDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainAttachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
int qemuCmdFlags)
for (i = 0 ; i < vm->def->ndisks ; i++) {
if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
- qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), disk->dst);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s already exists"), disk->dst);
return -1;
}
}
if (driver->securityDriver &&
driver->securityDriver->domainSetSecurityImageLabel &&
- driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
return -1;
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
goto error;
- if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk)))
goto error;
}
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
- driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
VIR_WARN("Unable to restore security label on %s", disk->src);
return -1;
}
-static int qemudDomainAttachPciControllerDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainAttachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainControllerDefPtr controller,
int qemuCmdFlags)
for (i = 0 ; i < vm->def->ncontrollers ; i++) {
if ((vm->def->controllers[i]->type == controller->type) &&
(vm->def->controllers[i]->idx == controller->idx)) {
- qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("target %s:%d already exists"),
- type, controller->idx);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s:%d already exists"),
+ type, controller->idx);
return -1;
}
}
static virDomainControllerDefPtr
-qemuDomainFindOrCreateSCSIDiskController(virConnectPtr conn,
- struct qemud_driver *driver,
+qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver,
virDomainObjPtr vm,
int controller,
int qemuCmdFlags)
cont->idx = 0;
VIR_INFO0("No SCSI controller present, hotplugging one");
- if (qemudDomainAttachPciControllerDevice(conn, driver,
+ if (qemudDomainAttachPciControllerDevice(driver,
vm, cont, qemuCmdFlags) < 0) {
VIR_FREE(cont);
return NULL;
}
-static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
int qemuCmdFlags)
for (i = 0 ; i < vm->def->ndisks ; i++) {
if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
- qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), disk->dst);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s already exists"), disk->dst);
return -1;
}
}
if (driver->securityDriver &&
driver->securityDriver->domainSetSecurityImageLabel &&
- driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
return -1;
/* We should have an address already, so make sure */
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unexpected disk address type %s"),
- virDomainDeviceAddressTypeToString(disk->info.type));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected disk address type %s"),
+ virDomainDeviceAddressTypeToString(disk->info.type));
goto error;
}
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
goto error;
- if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk)))
goto error;
}
goto error;
for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
- cont = qemuDomainFindOrCreateSCSIDiskController(conn, driver, vm, i, qemuCmdFlags);
+ cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i, qemuCmdFlags);
if (!cont)
goto error;
}
if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller %d was missing its PCI address"), cont->idx);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SCSI controller %d was missing its PCI address"), cont->idx);
goto error;
}
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
- driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
VIR_WARN("Unable to restore security label on %s", disk->src);
return -1;
}
-static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
int qemuCmdFlags)
for (i = 0 ; i < vm->def->ndisks ; i++) {
if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), disk->dst);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s already exists"), disk->dst);
return -1;
}
}
if (driver->securityDriver &&
driver->securityDriver->domainSetSecurityImageLabel &&
- driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
return -1;
if (!disk->src) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("disk source path is missing"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("disk source path is missing"));
goto error;
}
goto error;
if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
goto error;
- if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk)))
goto error;
}
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
- driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+ driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
VIR_WARN("Unable to restore security label on %s", disk->src);
return -1;
}
+/* XXX conn required for network -> bridge resolution */
static int qemudDomainAttachNetDevice(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
int vlan;
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_HOST_NET_ADD)) {
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT, "%s",
- _("installed qemu version does not support host_net_add"));
+ qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("installed qemu version does not support host_net_add"));
return -1;
}
if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
if (priv->monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("network device type '%s' cannot be attached: "
- "qemu is not using a unix socket monitor"),
- virDomainNetTypeToString(net->type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("network device type '%s' cannot be attached: "
+ "qemu is not using a unix socket monitor"),
+ virDomainNetTypeToString(net->type));
return -1;
}
vlan = qemuDomainNetVLAN(net);
if (vlan < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
- _("Unable to attach network devices without vlan"));
+ qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("Unable to attach network devices without vlan"));
goto cleanup;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
}
- if (!(netstr = qemuBuildHostNetStr(conn, net, ' ',
+ if (!(netstr = qemuBuildHostNetStr(net, ' ',
vlan, tapfd_name)))
goto try_tapfd_close;
close(tapfd);
tapfd = -1;
- if (!(nicstr = qemuBuildNicStr(conn, net, NULL, vlan)))
+ if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
goto try_remove;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
int qemuCmdFlags)
{
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("hostdev mode '%s' not supported"),
- virDomainHostdevModeTypeToString(hostdev->mode));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("hostdev mode '%s' not supported"),
+ virDomainHostdevModeTypeToString(hostdev->mode));
return -1;
}
break;
default:
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("hostdev subsys type '%s' not supported"),
- virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("hostdev subsys type '%s' not supported"),
+ virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
goto error;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot attach device on inactive domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot attach device on inactive domain"));
goto endjob;
}
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unable to find cgroup for %s\n"),
- vm->def->name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to find cgroup for %s\n"),
+ vm->def->name);
goto endjob;
}
if (dev->data.disk->src != NULL &&
dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
virCgroupAllowDevicePath(cgroup,
dev->data.disk->src) < 0) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unable to allow device %s"),
- dev->data.disk->src);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to allow device %s"),
+ dev->data.disk->src);
goto endjob;
}
}
case VIR_DOMAIN_DISK_DEVICE_DISK:
if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
- ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, driver, vm,
+ ret = qemudDomainAttachUsbMassstorageDevice(driver, vm,
dev->data.disk, qemuCmdFlags);
if (ret == 0)
dev->data.disk = NULL;
} else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
- ret = qemudDomainAttachPciDiskDevice(dom->conn, driver, vm,
+ ret = qemudDomainAttachPciDiskDevice(driver, vm,
dev->data.disk, qemuCmdFlags);
if (ret == 0)
dev->data.disk = NULL;
} else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
- ret = qemudDomainAttachSCSIDisk(dom->conn, driver, vm,
+ ret = qemudDomainAttachSCSIDisk(driver, vm,
dev->data.disk, qemuCmdFlags);
if (ret == 0)
dev->data.disk = NULL;
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("disk bus '%s' cannot be hotplugged."),
- virDomainDiskBusTypeToString(dev->data.disk->bus));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("disk bus '%s' cannot be hotplugged."),
+ virDomainDiskBusTypeToString(dev->data.disk->bus));
/* fallthrough */
}
break;
default:
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("disk device type '%s' cannot be hotplugged"),
- virDomainDiskDeviceTypeToString(dev->data.disk->device));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("disk device type '%s' cannot be hotplugged"),
+ virDomainDiskDeviceTypeToString(dev->data.disk->device));
/* Fallthrough */
}
if (ret != 0 && cgroup) {
}
} else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
- ret = qemudDomainAttachPciControllerDevice(dom->conn, driver, vm,
+ ret = qemudDomainAttachPciControllerDevice(driver, vm,
dev->data.controller, qemuCmdFlags);
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("disk controller bus '%s' cannot be hotplugged."),
- virDomainControllerTypeToString(dev->data.controller->type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("disk controller bus '%s' cannot be hotplugged."),
+ virDomainControllerTypeToString(dev->data.controller->type));
/* fallthrough */
}
} else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
if (ret == 0)
dev->data.hostdev = NULL;
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("device type '%s' cannot be attached"),
- virDomainDeviceTypeToString(dev->type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("device type '%s' cannot be attached"),
+ virDomainDeviceTypeToString(dev->type));
goto endjob;
}
const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot modify the persistent configuration of a domain"));
return -1;
}
return qemudDomainAttachDevice(dom, xml);
}
-static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainDetachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
}
if (!detach) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("disk %s not found"), dev->data.disk->dst);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("disk %s not found"), dev->data.disk->dst);
goto cleanup;
}
if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
- _("device cannot be detached without a PCI address"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("device cannot be detached without a PCI address"));
goto cleanup;
}
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityImageLabel &&
- driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, dev->data.disk) < 0)
+ driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, dev->data.disk) < 0)
VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
ret = 0;
return ret;
}
-static int qemudDomainDetachPciControllerDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainDetachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
}
if (!detach) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("disk controller %s:%d not found"),
- virDomainControllerTypeToString(dev->data.controller->type),
- dev->data.controller->idx);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("disk controller %s:%d not found"),
+ virDomainControllerTypeToString(dev->data.controller->type),
+ dev->data.controller->idx);
goto cleanup;
}
if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
- _("device cannot be detached without a PCI address"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("device cannot be detached without a PCI address"));
goto cleanup;
}
}
static int
-qemudDomainDetachNetDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+qemudDomainDetachNetDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
}
if (!detach) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"),
- dev->data.net->mac[0], dev->data.net->mac[1],
- dev->data.net->mac[2], dev->data.net->mac[3],
- dev->data.net->mac[4], dev->data.net->mac[5]);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"),
+ dev->data.net->mac[0], dev->data.net->mac[1],
+ dev->data.net->mac[2], dev->data.net->mac[3],
+ dev->data.net->mac[4], dev->data.net->mac[5]);
goto cleanup;
}
if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("device cannot be detached without a PCI address"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("device cannot be detached without a PCI address"));
goto cleanup;
}
if ((vlan = qemuDomainNetVLAN(detach)) < 0) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("unable to determine original VLAN"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("unable to determine original VLAN"));
goto cleanup;
}
return ret;
}
-static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainDetachHostPciDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
}
if (!detach) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("host pci device %.4x:%.2x:%.2x.%.1x not found"),
- dev->data.hostdev->source.subsys.u.pci.domain,
- dev->data.hostdev->source.subsys.u.pci.bus,
- dev->data.hostdev->source.subsys.u.pci.slot,
- dev->data.hostdev->source.subsys.u.pci.function);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("host pci device %.4x:%.2x:%.2x.%.1x not found"),
+ dev->data.hostdev->source.subsys.u.pci.domain,
+ dev->data.hostdev->source.subsys.u.pci.bus,
+ dev->data.hostdev->source.subsys.u.pci.slot,
+ dev->data.hostdev->source.subsys.u.pci.function);
return -1;
}
if (!virDomainDeviceAddressIsValid(&detach->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("device cannot be detached without a PCI address"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("device cannot be detached without a PCI address"));
return -1;
}
return ret;
}
-static int qemudDomainDetachHostDevice(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemudDomainDetachHostDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
int ret;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("hostdev mode '%s' not supported"),
- virDomainHostdevModeTypeToString(hostdev->mode));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("hostdev mode '%s' not supported"),
+ virDomainHostdevModeTypeToString(hostdev->mode));
return -1;
}
switch (hostdev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
- ret = qemudDomainDetachHostPciDevice(conn, driver, vm, dev);
+ ret = qemudDomainDetachHostPciDevice(driver, vm, dev);
break;
default:
- qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("hostdev subsys type '%s' not supported"),
- virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("hostdev subsys type '%s' not supported"),
+ virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
return -1;
}
if (driver->securityDriver &&
driver->securityDriver->domainRestoreSecurityHostdevLabel &&
- driver->securityDriver->domainRestoreSecurityHostdevLabel(conn, vm, dev->data.hostdev) < 0)
+ driver->securityDriver->domainRestoreSecurityHostdevLabel(NULL, vm, dev->data.hostdev) < 0)
VIR_WARN0("Failed to restore host device labelling");
return ret;
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot detach device on inactive domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot detach device on inactive domain"));
goto endjob;
}
if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
- ret = qemudDomainDetachPciDiskDevice(dom->conn, driver, vm, dev);
+ ret = qemudDomainDetachPciDiskDevice(driver, vm, dev);
} else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
- ret = qemudDomainDetachNetDevice(dom->conn, driver, vm, dev);
+ ret = qemudDomainDetachNetDevice(driver, vm, dev);
} else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
- ret = qemudDomainDetachPciControllerDevice(dom->conn, driver, vm, dev);
+ ret = qemudDomainDetachPciControllerDevice(driver, vm, dev);
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- _("disk controller bus '%s' cannot be hotunplugged."),
- virDomainControllerTypeToString(dev->data.controller->type));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("disk controller bus '%s' cannot be hotunplugged."),
+ virDomainControllerTypeToString(dev->data.controller->type));
/* fallthrough */
}
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
- ret = qemudDomainDetachHostDevice(dom->conn, driver, vm, dev);
+ ret = qemudDomainDetachHostDevice(driver, vm, dev);
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("This type of device cannot be hot unplugged"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("This type of device cannot be hot unplugged"));
}
if (!ret && virDomainSaveStatus(dom->conn, driver->caps, driver->stateDir, vm) < 0)
const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot modify the persistent configuration of a domain"));
return -1;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot set autostart for transient domain"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot set autostart for transient domain"));
goto cleanup;
}
qemuDriverLock(driver);
if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- __FUNCTION__);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ __FUNCTION__);
goto cleanup;
}
qemuDriverLock(driver);
if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- __FUNCTION__);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ __FUNCTION__);
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("No such domain %s"), dom->uuid);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No such domain %s"), dom->uuid);
goto cleanup;
}
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find cgroup for domain %s"), vm->def->name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
if (STREQ(param->field, "cpu_shares")) {
int rc;
if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, "%s",
- _("invalid type for cpu_shares tunable, expected a 'ullong'"));
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("invalid type for cpu_shares tunable, expected a 'ullong'"));
goto cleanup;
}
goto cleanup;
}
} else {
- qemudReportError(dom->conn, domain, NULL, VIR_ERR_INVALID_ARG,
- _("Invalid parameter `%s'"), param->field);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("Invalid parameter `%s'"), param->field);
goto cleanup;
}
}
qemuDriverLock(driver);
if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- __FUNCTION__);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ __FUNCTION__);
goto cleanup;
}
if ((*nparams) != 1) {
- qemudReportError(dom->conn, domain, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("Invalid parameter count"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("Invalid parameter count"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
- qemudReportError(dom->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
- _("No such domain %s"), dom->uuid);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No such domain %s"), dom->uuid);
goto cleanup;
}
if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot find cgroup for domain %s"), vm->def->name);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find cgroup for domain %s"), vm->def->name);
goto cleanup;
}
params[0].value.ul = val;
params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
if (virStrcpyStatic(params[0].field, "cpu_shares") == NULL) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Field cpu_shares too long for destination"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Field cpu_shares too long for destination"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive (vm)) {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
}
if (!disk) {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("invalid path: %s"), path);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("invalid path: %s"), path);
goto endjob;
}
if (!disk->info.alias) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("missing disk device alias name for %s"), disk->dst);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("missing disk device alias name for %s"), disk->dst);
goto endjob;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto cleanup;
}
if (ret == 0)
ret = linuxDomainInterfaceStats(path, stats);
else
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- _("invalid path, '%s' is not a known interface"), path);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("invalid path, '%s' is not a known interface"), path);
cleanup:
if (vm)
qemudDomainInterfaceStats (virDomainPtr dom,
const char *path ATTRIBUTE_UNUSED,
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", __FUNCTION__);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", __FUNCTION__);
return -1;
}
#endif
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
ret = qemuMonitorTextGetMemoryStats(priv->mon, stats, nr_stats);
qemuDomainObjExitMonitor(vm);
} else {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
}
cleanup:
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!path || path[0] == '\0') {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("NULL or empty path"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("NULL or empty path"));
goto cleanup;
}
ret = 0;
} else {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("invalid path"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("invalid path"));
}
cleanup:
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
int ret = -1;
if (!qemust) {
- qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream is not open"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream is not open"));
return -1;
}
qemuDriverLock(driver);
if (qemust->watch == 0) {
- qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream does not have a callback registered"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream does not have a callback registered"));
goto cleanup;
}
int ret = -1;
if (!qemust) {
- qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream is not open"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream is not open"));
return -1;
}
qemuDriverLock(driver);
if (qemust->watch == 0) {
- qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream does not have a callback registered"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream does not have a callback registered"));
goto cleanup;
}
int ret = -1;
if (!qemust) {
- qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream is not open"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream is not open"));
return -1;
}
qemuDriverLock(driver);
if (qemust->watch != 0) {
- qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream already has a callback registered"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream already has a callback registered"));
goto cleanup;
}
qemuStreamMigEvent,
st,
NULL)) < 0) {
- qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot register file watch on stream"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot register file watch on stream"));
goto cleanup;
}
int ret;
if (!qemust) {
- qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("stream is not open"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("stream is not open"));
return -1;
}
qemuDriverLock(driver);
if (!dom_xml) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no domain XML passed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("no domain XML passed"));
goto cleanup;
}
if (!(flags & VIR_MIGRATE_TUNNELLED)) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("PrepareTunnel called but no TUNNELLED flag set"));
goto cleanup;
}
if (st == NULL) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("tunnelled migration requested but NULL stream passed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("tunnelled migration requested but NULL stream passed"));
goto cleanup;
}
/* Parse the domain XML. */
if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
VIR_DOMAIN_XML_INACTIVE))) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to parse XML"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to parse XML"));
goto cleanup;
}
driver->caps,
&driver->domains,
def))) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to assign new VM"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to assign new VM"));
goto cleanup;
}
def = NULL;
/* check that this qemu version supports the interactive exec */
if (qemudExtractVersionInfo(vm->def->emulator, NULL, &qemuCmdFlags) < 0) {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Cannot determine QEMU argv syntax %s"),
- vm->def->emulator);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cannot determine QEMU argv syntax %s"),
+ vm->def->emulator);
goto endjob;
}
if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX)
else if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)
internalret = virAsprintf(&migrateFrom, "exec:nc -U -l %s", unixfile);
else {
- qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("Destination qemu is too old to support tunnelled migration"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("Destination qemu is too old to support tunnelled migration"));
goto endjob;
}
if (internalret < 0) {
/* this is a logical error; we never should have gotten here with
* VIR_MIGRATE_TUNNELLED set
*/
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("Tunnelled migration requested but invalid RPC method called"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Tunnelled migration requested but invalid RPC method called"));
goto cleanup;
}
if (!dom_xml) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no domain XML passed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("no domain XML passed"));
goto cleanup;
}
* characters in hostname part don't matter.
*/
if (!STRPREFIX (uri_in, "tcp:")) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("only tcp URIs are supported for KVM/QEMU migrations"));
+ qemuReportError (VIR_ERR_INVALID_ARG,
+ "%s", _("only tcp URIs are supported for KVM/QEMU migrations"));
goto cleanup;
}
p++; /* definitely has a ':' in it, see above */
this_port = virParseNumber (&p);
if (this_port == -1 || p-uri_in != strlen (uri_in)) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("URI ended with incorrect ':port'"));
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ "%s", _("URI ended with incorrect ':port'"));
goto cleanup;
}
}
/* Parse the domain XML. */
if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
VIR_DOMAIN_XML_INACTIVE))) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to parse XML"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to parse XML"));
goto cleanup;
}
driver->caps,
&driver->domains,
def))) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to assign new VM"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to assign new VM"));
goto cleanup;
}
def = NULL;
/* Perform migration using QEMU's native TCP migrate support,
* not encrypted obviously
*/
-static int doNativeMigrate(virDomainPtr dom,
- struct qemud_driver *driver,
+static int doNativeMigrate(struct qemud_driver *driver,
virDomainObjPtr vm,
const char *uri,
unsigned long flags ATTRIBUTE_UNUSED,
uribits = xmlParseURI(uri);
}
if (!uribits) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse URI %s"), uri);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse URI %s"), uri);
goto cleanup;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (status != QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("migrate did not successfully complete"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("migrate did not successfully complete"));
goto cleanup;
}
}
-static int doTunnelSendAll(virDomainPtr dom,
- virStreamPtr st,
+static int doTunnelSendAll(virStreamPtr st,
int sock)
{
char buffer[65536];
break;
if (virStreamSend(st, buffer, nbytes) < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s",
- _("Failed to write migration data to remote libvirtd"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Failed to write migration data to remote libvirtd"));
return -1;
}
}
sa_qemu.sun_family = AF_UNIX;
if (virStrcpy(sa_qemu.sun_path, unixfile,
sizeof(sa_qemu.sun_path)) == NULL) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Unix socket '%s' too big for destination"),
- unixfile);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unix socket '%s' too big for destination"),
+ unixfile);
goto cleanup;
}
unlink(unixfile);
/* check that this qemu version supports the unix migration */
if (qemudExtractVersionInfo(vm->def->emulator, NULL, &qemuCmdFlags) < 0) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("Cannot extract Qemu version from '%s'"),
- vm->def->emulator);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cannot extract Qemu version from '%s'"),
+ vm->def->emulator);
goto cleanup;
}
if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX) &&
!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)) {
- qemudReportError(dom->conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("Source qemu is too old to support tunnelled migration"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("Source qemu is too old to support tunnelled migration"));
goto cleanup;
}
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (internalret < 0) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("tunnelled migration monitor command failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("tunnelled migration monitor command failed"));
goto finish;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s",_("migrate failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s",_("migrate failed"));
goto cancel;
}
goto cancel;
}
- retval = doTunnelSendAll(dom, st, client_sock);
+ retval = doTunnelSendAll(st, client_sock);
cancel:
if (retval != 0) {
goto cleanup;
if (uri_out == NULL) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
- _("domainMigratePrepare2 did not set uri"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("domainMigratePrepare2 did not set uri"));
goto cleanup;
}
- if (doNativeMigrate(dom, driver, vm, uri_out, flags, dname, resource) < 0)
+ if (doNativeMigrate(driver, vm, uri_out, flags, dname, resource) < 0)
goto finish;
retval = 0;
dconn = virConnectOpen(uri);
if (dconn == NULL) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- _("Failed to connect to remote libvirt URI %s"), uri);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("Failed to connect to remote libvirt URI %s"), uri);
return -1;
}
if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
VIR_DRV_FEATURE_MIGRATION_P2P)) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s",
- _("Destination libvirt does not support peer-to-peer migration protocol"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Destination libvirt does not support peer-to-peer migration protocol"));
goto cleanup;
}
dom_xml = virDomainDefFormat(dom->conn, vm->def, VIR_DOMAIN_XML_SECURE);
if (!dom_xml) {
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to get domain xml"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to get domain xml"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
goto cleanup;
if (!virDomainObjIsActive(vm)) {
- qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
goto endjob;
}
/* doPeer2PeerMigrate already set the error, so just get out */
goto endjob;
} else {
- if (doNativeMigrate(dom, driver, vm, uri, flags, dname, resource) < 0)
+ if (doNativeMigrate(driver, vm, uri, flags, dname, resource) < 0)
goto endjob;
}
qemuDriverLock(driver);
vm = virDomainFindByName(&driver->domains, dname);
if (!vm) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_NO_DOMAIN,
- _("no domain with matching name '%s'"), dname);
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching name '%s'"), dname);
goto cleanup;
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuMonitorStartCPUs(priv->mon, dconn) < 0) {
if (virGetLastError() == NULL)
- qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("resume operation failed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("resume operation failed"));
qemuDomainObjExitMonitorWithDriver(driver, vm);
goto endjob;
}
}
if (!cap) {
- qemudReportError(dev->conn, NULL, NULL, VIR_ERR_INVALID_ARG,
- _("device %s is not a PCI device"), dev->name);
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("device %s is not a PCI device"), dev->name);
goto out;
}
qemuDriverLock(driver);
if (!driver->caps || !driver->caps->host.cpu) {
- qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cannot get host CPU capabilities"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cannot get host CPU capabilities"));
}
else
ret = cpuCompareXML(conn, driver->caps->host.cpu, xmlDesc);
char *info;
if (qemuMonitorCommand(mon, "stop", &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot stop CPU execution"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot stop CPU execution"));
return -1;
}
VIR_FREE(info);
char *info;
if (qemuMonitorCommand(mon, "system_powerdown", &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("system shutdown operation failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("system shutdown operation failed"));
return -1;
}
VIR_FREE(info);
size_t ncpupids = 0;
if (qemuMonitorCommand(mon, "info cpus", &qemucpus) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to fetch CPU thread info"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to fetch CPU thread info"));
return -1;
}
char *offset;
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("could not query memory balloon allocation"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("could not query memory balloon allocation"));
return -1;
}
char *end;
offset += strlen(BALLOON_PREFIX);
if (virStrToLong_ui(offset, &end, 10, &memMB) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could not parse memory balloon allocation from '%s'"), reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could not parse memory balloon allocation from '%s'"), reply);
goto cleanup;
}
*currmem = memMB * 1024;
char *offset;
if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("could not query memory balloon statistics"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("could not query memory balloon statistics"));
return -1;
}
int devnamelen = strlen(devname);
if (qemuMonitorCommand (mon, "info blockstats", &info) < 0) {
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("'info blockstats' command failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("'info blockstats' command failed"));
goto cleanup;
}
* to detect if qemu supports the command.
*/
if (strstr(info, "\ninfo ")) {
- qemudReportError (NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- "%s",
- _("'info blockstats' not supported by this qemu"));
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ "%s",
+ _("'info blockstats' not supported by this qemu"));
goto cleanup;
}
}
/* If we reach here then the device was not found. */
- qemudReportError (NULL, NULL, NULL, VIR_ERR_INVALID_ARG,
- _("no stats found for device %s"), devname);
+ qemuReportError (VIR_ERR_INVALID_ARG,
+ _("no stats found for device %s"), devname);
cleanup:
VIR_FREE(info);
qemuMonitorSendVNCPassphrase,
(char *)password,
-1, &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("setting VNC password failed"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("setting VNC password failed"));
return -1;
}
VIR_FREE(info);
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("could not balloon memory allocation"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("could not balloon memory allocation"));
VIR_FREE(cmd);
return -1;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could not eject media on %s"), devname);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could not eject media on %s"), devname);
goto cleanup;
}
* device not found, device is locked ...
* No message is printed on success it seems */
if (strstr(reply, "\ndevice ")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could not eject media on %s: %s"), devname, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could not eject media on %s: %s"), devname, reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could not eject media on %s"), devname);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could not eject media on %s"), devname);
goto cleanup;
}
* device not found, device is locked ...
* No message is printed on success it seems */
if (strstr(reply, "\ndevice ")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could not eject media on %s: %s"), devname, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could not eject media on %s: %s"), devname, reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("could save memory region to '%s'"), path);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("could save memory region to '%s'"), path);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("could restrict migration speed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("could restrict migration speed"));
goto cleanup;
}
*total = 0;
if (qemuMonitorCommand(mon, "info migrate", &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot query migration status"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot query migration status"));
return -1;
}
*end = '\0';
if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unexpected migration status in %s"), reply);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected migration status in %s"), reply);
goto cleanup;
}
tmp += strlen(MIGRATION_TRANSFER_PREFIX);
if (virStrToLong_ull(tmp, NULL, 10, transferred) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse migration data transferred statistic %s"), tmp);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse migration data transferred statistic %s"), tmp);
goto cleanup;
}
*transferred *= 1024;
tmp += strlen(MIGRATION_REMAINING_PREFIX);
if (virStrToLong_ull(tmp, NULL, 10, remaining) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse migration data remaining statistic %s"), tmp);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse migration data remaining statistic %s"), tmp);
goto cleanup;
}
*remaining *= 1024;
tmp += strlen(MIGRATION_TOTAL_PREFIX);
if (virStrToLong_ull(tmp, NULL, 10, total) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("cannot parse migration data total statistic %s"), tmp);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse migration data total statistic %s"), tmp);
goto cleanup;
}
*total *= 1024;
}
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- _("unable to start migration to %s"), dest);
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to start migration to %s"), dest);
goto cleanup;
}
/* Now check for "fail" in the output string */
if (strstr(info, "fail") != NULL) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("migration to '%s' failed: %s"), dest, info);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("migration to '%s' failed: %s"), dest, info);
goto cleanup;
}
/* If the command isn't supported then qemu prints:
* unknown command: migrate" */
if (strstr(info, "unknown command:")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- _("migration to '%s' not supported by this qemu: %s"), dest, info);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("migration to '%s' not supported by this qemu: %s"), dest, info);
goto cleanup;
}
char *info = NULL;
if (qemuMonitorCommand(mon, "migrate_cancel", &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to cancel migration"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to cancel migration"));
return -1;
}
VIR_FREE(info);
}
if (qemuMonitorCommand(mon, cmd, &info) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot run monitor command to add usb disk"));
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command to add usb disk"));
goto cleanup;
}
/* If the command failed qemu prints:
* Could not add ... */
if (strstr(info, "Could not add ")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("unable to add USB disk %s: %s"), path, info);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("unable to add USB disk %s: %s"), path, info);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot attach usb device"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot attach usb device"));
goto cleanup;
}
/* If the command failed qemu prints:
* Could not add ... */
if (strstr(reply, "Could not add ")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("adding usb device failed"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("adding usb device failed"));
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot attach host pci device"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot attach host pci device"));
goto cleanup;
}
if (strstr(reply, "invalid type: host")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
- _("PCI device assignment is not supported by this version of qemu"));
+ qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("PCI device assignment is not supported by this version of qemu"));
goto cleanup;
}
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("parsing pci_add reply failed: %s"), reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("parsing pci_add reply failed: %s"), reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s disk %s"), bus, path);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("cannot attach %s disk %s"), bus, path);
goto cleanup;
}
goto try_command;
}
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("adding %s disk failed %s: %s"), bus, path, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("adding %s disk failed %s: %s"), bus, path, reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to add NIC with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to add NIC with '%s'"), cmd);
goto cleanup;
}
if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("parsing pci_add reply failed: %s"), reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("parsing pci_add reply failed: %s"), reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to remove PCI device"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to remove PCI device"));
goto cleanup;
}
* nothing is printed on success */
if (strstr(reply, "invalid slot") ||
strstr(reply, "Invalid pci address")) {
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
- guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
+ guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
goto cleanup;
}
}
if (qemuMonitorCommandWithFd(mon, cmd, fd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to pass fd to qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to pass fd to qemu with '%s'"), cmd);
goto cleanup;
}
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
if (strstr(reply, "unknown command:")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- _("qemu does not support sending of file handles: %s"),
- reply);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("qemu does not support sending of file handles: %s"),
+ reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to close fd in qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to close fd in qemu with '%s'"), cmd);
goto cleanup;
}
/* If the command isn't supported then qemu prints:
* unknown command: getfd" */
if (strstr(reply, "unknown command:")) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
- _("qemu does not support closing of file handles: %s"),
- reply);
+ qemuReportError(VIR_ERR_NO_SUPPORT,
+ _("qemu does not support closing of file handles: %s"),
+ reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to close fd in qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to close fd in qemu with '%s'"), cmd);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to remove host network in qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to remove host network in qemu with '%s'"), cmd);
goto cleanup;
}
int ret = -1;
if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
- _("failed to retrieve chardev info in qemu with 'info chardev'"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("failed to retrieve chardev info in qemu with 'info chardev'"));
goto cleanup;
}
}
if (virHashAddEntry(paths, id, path) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to save chardev path '%s'"),
- path);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to save chardev path '%s'"),
+ path);
VIR_FREE(path);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s disk controller"), bus);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("cannot attach %s disk controller"), bus);
goto cleanup;
}
goto try_command;
}
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("adding %s disk controller failed: %s"), bus, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("adding %s disk controller failed: %s"), bus, reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to close fd in qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to close fd in qemu with '%s'"), cmd);
goto cleanup;
}
tryOldSyntax = 1;
goto try_command;
}
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("adding %s disk failed: %s"), drivestr, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("adding %s disk failed: %s"), drivestr, reply);
goto cleanup;
}
(p) += strlen(lbl);
#define GET_INT(p, base, val) \
if (virStrToLong_ui((p), &(p), (base), &(val)) < 0) { \
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, \
- _("cannot parse value for %s"), #val); \
+ qemuReportError(VIR_ERR_OPERATION_FAILED, \
+ _("cannot parse value for %s"), #val); \
break; \
}
#define SKIP_SPACE(p) \
*retaddrs = NULL;
if (qemuMonitorCommand(mon, "info pci", &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("cannot query PCI addresses"));
return -1;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("cannot attach %s device"), devicestr);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("cannot attach %s device"), devicestr);
goto cleanup;
}
if (STRNEQ(reply, "")) {
- qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("adding %s device failed: %s"), devicestr, reply);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("adding %s device failed: %s"), devicestr, reply);
goto cleanup;
}
}
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
- qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
- _("failed to close fd in qemu with '%s'"), cmd);
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("failed to close fd in qemu with '%s'"), cmd);
goto cleanup;
}