char *name;
virDomainDefPtr def;
+ int handshakeFd;
+
pid_t initpid;
size_t nveths;
virLXCControllerConsoleClose(&(ctrl->consoles[i]));
VIR_FREE(ctrl->consoles);
+ VIR_FORCE_CLOSE(ctrl->handshakeFd);
+
virDomainDefFree(ctrl->def);
VIR_FREE(ctrl->name);
}
+static int virLXCControllerDaemonHandshake(virLXCControllerPtr ctrl)
+{
+ if (lxcContainerSendContinue(ctrl->handshakeFd) < 0) {
+ virReportSystemError(errno, "%s",
+ _("error sending continue signal to daemon"));
+ return -1;
+ }
+ VIR_FORCE_CLOSE(ctrl->handshakeFd);
+ return 0;
+}
+
+
static int virLXCControllerValidateNICs(virLXCControllerPtr ctrl)
{
if (ctrl->def->nnets != ctrl->nveths) {
virLXCControllerRun(virLXCControllerPtr ctrl,
virSecurityManagerPtr securityDriver,
int monitor,
- int client,
- int handshakefd)
+ int client)
{
int rc = -1;
int control[2] = { -1, -1};
if (lxcControllerClearCapabilities() < 0)
goto cleanup;
- if (lxcContainerSendContinue(handshakefd) < 0) {
- virReportSystemError(errno, "%s",
- _("error sending continue signal to parent"));
+ if (virLXCControllerDaemonHandshake(ctrl) < 0)
goto cleanup;
- }
- VIR_FORCE_CLOSE(handshakefd);
if (virSetBlocking(monitor, false) < 0 ||
virSetBlocking(client, false) < 0) {
VIR_FREE(devpts);
VIR_FORCE_CLOSE(control[0]);
VIR_FORCE_CLOSE(control[1]);
- VIR_FORCE_CLOSE(handshakefd);
VIR_FORCE_CLOSE(containerhandshake[0]);
VIR_FORCE_CLOSE(containerhandshake[1]);
size_t nveths = 0;
char **veths = NULL;
int monitor = -1;
- int handshakefd = -1;
+ int handshakeFd = -1;
int bg = 0;
char *sockpath = NULL;
const struct option options[] = {
break;
case 's':
- if (virStrToLong_i(optarg, NULL, 10, &handshakefd) < 0) {
+ if (virStrToLong_i(optarg, NULL, 10, &handshakeFd) < 0) {
fprintf(stderr, "malformed --handshakefd argument '%s'",
optarg);
goto cleanup;
goto cleanup;
}
- if (handshakefd < 0) {
+ if (handshakeFd < 0) {
fprintf(stderr, "%s: missing --handshake argument for container PTY\n",
argv[0]);
goto cleanup;
if (!(ctrl = virLXCControllerNew(name)))
goto cleanup;
+ ctrl->handshakeFd = handshakeFd;
+
VIR_DEBUG("Security model %s type %s label %s imagelabel %s",
NULLSTR(ctrl->def->seclabel.model),
virDomainSeclabelTypeToString(ctrl->def->seclabel.type),
}
rc = virLXCControllerRun(ctrl, securityDriver,
- monitor, client,
- handshakefd);
+ monitor, client);
cleanup:
virPidFileDelete(LXC_STATE_DIR, name);