static int
-umlConnectTapDevice(virConnectPtr conn,
- virDomainNetDefPtr net,
+umlConnectTapDevice(virDomainNetDefPtr net,
const char *bridge)
{
brControl *brctl = NULL;
&net->ifname, BR_TAP_PERSIST, &tapfd))) {
if (errno == ENOTSUP) {
/* In this particular case, give a better diagnostic. */
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to add tap interface to bridge. "
"%s is not a bridge device"), bridge);
} else if (template_ifname) {
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap");
if (def->data.ethernet.ipaddr) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet inteface"));
goto error;
}
if (def->data.ethernet.script) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("script execution not supported for ethernet inteface"));
goto error;
}
break;
case VIR_DOMAIN_NET_TYPE_SERVER:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP server networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_CLIENT:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP client networking type not supported"));
goto error;
virNetworkPtr network = virNetworkLookupByName(conn,
def->data.network.name);
if (!network) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' not found"),
def->data.network.name);
goto error;
goto error;
}
- if (umlConnectTapDevice(conn, def, bridge) < 0) {
+ if (umlConnectTapDevice(def, bridge) < 0) {
VIR_FREE(bridge);
goto error;
}
}
case VIR_DOMAIN_NET_TYPE_BRIDGE:
- if (umlConnectTapDevice(conn, def, def->data.bridge.brname) < 0)
+ if (umlConnectTapDevice(def, def->data.bridge.brname) < 0)
goto error;
/* ethNNN=tuntap,tapname,macaddr,gateway */
break;
case VIR_DOMAIN_NET_TYPE_INTERNAL:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_DIRECT:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("direct networking type not supported"));
goto error;
}
static char *
-umlBuildCommandLineChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+umlBuildCommandLineChr(virDomainChrDefPtr def,
const char *dev)
{
char *ret = NULL;
case VIR_DOMAIN_CHR_TYPE_TCP:
if (def->data.tcp.listen != 1) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("only TCP listen is supported for chr device"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only TCP listen is supported for chr device"));
return NULL;
}
case VIR_DOMAIN_CHR_TYPE_UDP:
case VIR_DOMAIN_CHR_TYPE_UNIX:
default:
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported chr device type %d"), def->type);
break;
}
virDomainDiskDefPtr disk = vm->def->disks[i];
if (!STRPREFIX(disk->dst, "ubd")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type '%s'"), disk->dst);
goto error;
}
for (i = 0 ; i < UML_MAX_CHAR_DEVICE ; i++) {
char *ret;
if (i == 0 && vm->def->console)
- ret = umlBuildCommandLineChr(conn, vm->def->console, "con");
+ ret = umlBuildCommandLineChr(vm->def->console, "con");
else
if (virAsprintf(&ret, "con%d=none", i) < 0)
goto no_memory;
if (vm->def->serials[j]->target.port == i)
chr = vm->def->serials[j];
if (chr)
- ret = umlBuildCommandLineChr(conn, chr, "ssl");
+ ret = umlBuildCommandLineChr(chr, "ssl");
else
if (virAsprintf(&ret, "ssl%d=none", i) < 0)
goto no_memory;
}
-static int umlOpenMonitor(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlOpenMonitor(struct uml_driver *driver,
virDomainObjPtr vm);
static int umlReadPidFile(struct uml_driver *driver,
virDomainObjPtr vm);
virDomainObjPtr vm);
-static int umlMonitorCommand (virConnectPtr conn,
- const struct uml_driver *driver,
- const virDomainObjPtr vm,
- const char *cmd,
- char **reply);
+static int umlMonitorCommand(const struct uml_driver *driver,
+ const virDomainObjPtr vm,
+ const char *cmd,
+ char **reply);
static struct uml_driver *uml_driver = NULL;
return -1;
}
requery:
- if (umlMonitorCommand(NULL, driver, dom, cmd, &res) < 0)
+ if (umlMonitorCommand(driver, dom, cmd, &res) < 0)
return -1;
if (res && STRPREFIX(res, "pts:")) {
dom->def->id = driver->nextvmid++;
dom->state = VIR_DOMAIN_RUNNING;
- if (umlOpenMonitor(NULL, driver, dom) < 0) {
+ if (umlOpenMonitor(driver, dom) < 0) {
VIR_WARN0("Could not open monitor for new domain");
umlShutdownVMDaemon(NULL, driver, dom);
} else if (umlIdentifyChrPTY(driver, dom) < 0) {
return rc;
}
-static int umlMonitorAddress(virConnectPtr conn,
- const struct uml_driver *driver,
+static int umlMonitorAddress(const struct uml_driver *driver,
virDomainObjPtr vm,
struct sockaddr_un *addr) {
char *sockname;
memset(addr, 0, sizeof *addr);
addr->sun_family = AF_UNIX;
if (virStrcpyStatic(addr->sun_path, sockname) == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Unix path %s too long for destination"), sockname);
retval = -1;
}
return retval;
}
-static int umlOpenMonitor(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlOpenMonitor(struct uml_driver *driver,
virDomainObjPtr vm) {
struct sockaddr_un addr;
struct stat sb;
int retries = 0;
umlDomainObjPrivatePtr priv = vm->privateData;
- if (umlMonitorAddress(conn, driver, vm, &addr) < 0)
+ if (umlMonitorAddress(driver, vm, &addr) < 0)
return -1;
VIR_DEBUG("Dest address for monitor is '%s'", addr.sun_path);
};
-static int umlMonitorCommand(virConnectPtr conn,
- const struct uml_driver *driver,
+static int umlMonitorCommand(const struct uml_driver *driver,
const virDomainObjPtr vm,
const char *cmd,
char **reply)
*reply = NULL;
- if (umlMonitorAddress(conn, driver, vm, &addr) < 0)
+ if (umlMonitorAddress(driver, vm, &addr) < 0)
return -1;
memset(&req, 0, sizeof(req));
return -1;
}
if (virStrcpyStatic(req.data, cmd) == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("Command %s too long for destination"), cmd);
return -1;
}
FD_ZERO(&keepfd);
if (virDomainObjIsActive(vm)) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("VM is already active"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("VM is already active"));
return -1;
}
if (!vm->def->os.kernel) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("no kernel specified"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("no kernel specified"));
return -1;
}
/* Make sure the binary we are about to try exec'ing exists.
if (uml_driver->privileged) {
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
} else {
if (STRNEQ (conn->uri->path, "/session")) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///session"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
/* URI was good, but driver isn't active */
if (uml_driver == NULL) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("uml state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
- umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!obj) {
- umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+ umlReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
uname(&ut);
if (virParseVersionString(ut.release, &driver->umlVersion) < 0) {
- umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ umlReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse version %s"), ut.release);
goto cleanup;
}
vm = virDomainFindByID(&driver->domains, dom->id);
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
#if 0
if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("shutdown operation failed"));
+ umlReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("shutdown operation failed"));
goto cleanup;
}
ret = 0;
umlDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching id %d"), dom->id);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching id %d"), dom->id);
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (newmax < vm->def->memory) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set max memory lower than current memory"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("cannot set max memory lower than current memory"));
goto cleanup;
}
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ umlReportError(VIR_ERR_INVALID_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
- "%s", _("cannot set memory of an active domain"));
+ umlReportError(VIR_ERR_NO_SUPPORT, "%s",
+ _("cannot set memory of an active domain"));
goto cleanup;
}
if (newmem > vm->def->maxmem) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("cannot set memory higher than max memory"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("cannot set memory higher than max memory"));
goto cleanup;
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
info->cpuTime = 0;
} else {
if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot read cputime for domain"));
+ umlReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("cannot read cputime for domain"));
goto cleanup;
}
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
umlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot delete active domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot delete active domain"));
goto cleanup;
}
if (!vm->persistent) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot undefine transient domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot undefine transient domain"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (!vm->persistent) {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
- "%s", _("cannot set autostart for transient domain"));
+ umlReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot set autostart for transient domain"));
goto cleanup;
}
umlDriverUnlock(driver);
if (!vm) {
- umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- "%s", _("no domain with matching uuid"));
+ umlReportError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
if (!path || path[0] == '\0') {
- umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("NULL or empty path"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("NULL or empty path"));
goto cleanup;
}
ret = 0;
} else {
- umlReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("invalid path"));
+ umlReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("invalid path"));
}
cleanup: