From patchwork Mon Dec 9 19:58:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 181089 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4812961ile; Mon, 9 Dec 2019 11:57:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxSmZw9k8C7+JFDWWnzu3/furAvMVqZDahdQLW7CQxiz7fLHbIEVsH/y6iGnMHL+0CWtoe9 X-Received: by 2002:a25:d4c6:: with SMTP id m189mr22551773ybf.133.1575921472242; Mon, 09 Dec 2019 11:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575921472; cv=none; d=google.com; s=arc-20160816; b=t6+eFJdgBWMvupxDceMJosaCTaUNbkQRAJSh+j5uM/HfdP5h7YGdvDpKqcQYVcKqUo Ny9gqAxxNDXkvH5cwFtZQsSApnfcrvPpVivb5MdkBBIFLBA/VHcw858c665lDg43CUtZ vXfjgKlo0VQLOu6A3pFfvj59GsV+kzlebjp2EsA1lNmwlchcsYY9peyapglTGXyBh8XM mNy8JDF7zwfBRwc9cDJ8JV3tjUQLHoptlK9UkvS3wghUADp5/NAGuINfIJsBnVzJ9PEk 1Z1/GAhI+k3AyPq9HVpYSCxZYWtSMhHP2QiHxL5mH56D0XEdnHCEvEG53t+sk6K1Imry yJ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:errors-to:sender:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:delivered-to:dkim-signature; bh=A2/Khds3RFxpSyuiIDT7iYSh7hJ2wFnDuTqnKrDpvbw=; b=iiTQEqxsYNGZULMP0ExS7LushicKf92PO1xRLzQZ0BnEuL7j3Y5E5RU5GiXMcrhovl 45yUljiTqjn0744HEd2so8+2GgvQeasshRQ4+5gHoKVzPBGjedr6t38/6DYaAd9gf/R1 J8tCP/pDauHuCYh3HTBtv8eQSlK/MfARDAcPZTxM+fbOYXcw9P0HfVBaIlDxBX2vqinR BLD6+PsP7H3I/31lr11zbwKRYC57+9vnnNfBDkX1SPB+X6arOzy88g35E/Y9/rucWHs7 JpoEnwXSpZrKkSUb/X4tv23zf26z90cHXRaVE5/vLiI8lcu8mdLgR1b6mkgLiQx+an3P fRFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGs+GgCM; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com. [205.139.110.61]) by mx.google.com with ESMTPS id o207si332767ywd.466.2019.12.09.11.57.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2019 11:57:52 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGs+GgCM; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575921471; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=A2/Khds3RFxpSyuiIDT7iYSh7hJ2wFnDuTqnKrDpvbw=; b=iGs+GgCMgLpJ29PmU3rnhuzM6MV4Q/LZEy3BEO41txfsftA87mhD4q5z7W5VcstoNKwFCb 9jOuBjY/XepPV0FIoeIVqx4uhTozfMv/orl3lC6F8Pl6wfA+qInBLD2sSf9IGSsqOIvtzC lCYBKnVZ8dv68U8WOY37VMQ0kChg8mE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-M7vyZBxEOQO96H-n_kuKcw-1; Mon, 09 Dec 2019 14:57:50 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03ACF8DA5E0; Mon, 9 Dec 2019 19:57:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23D9D194BB; Mon, 9 Dec 2019 19:57:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DC11765D2B; Mon, 9 Dec 2019 19:57:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9Jvb8l028474 for ; Mon, 9 Dec 2019 14:57:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA93960C81; Mon, 9 Dec 2019 19:57:37 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-123-82.rdu2.redhat.com [10.10.123.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3357060C05; Mon, 9 Dec 2019 19:57:34 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 9 Dec 2019 14:58:51 -0500 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Cole Robinson Subject: [libvirt] [PATCH v2] lxc: Refresh capabilities if they have never been initalized X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: M7vyZBxEOQO96H-n_kuKcw-1 X-Mimecast-Spam-Score: 0 Adjust virLXCDriverGetCapabilities to fill in driver->caps if it is empty, regardless of the passed 'refresh' value. This matches the pattern used in virQEMUDriverGetCapabilities This fixes LXC XML startup parsing for me Signed-off-by: Cole Robinson --- v2: Use the virQEMUDriverGetCapabilities like danpb suggested src/lxc/lxc_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Daniel P. Berrangé diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index 2df1537b22..adf7a0b66c 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -196,6 +196,14 @@ virCapsPtr virLXCDriverGetCapabilities(virLXCDriverPtr driver, driver->caps = caps; } else { lxcDriverLock(driver); + + if (driver->caps == NULL || + driver->caps->nguests == 0) { + VIR_DEBUG("Capabilities didn't detect any guests. Forcing a " + "refresh."); + lxcDriverUnlock(driver); + return virLXCDriverGetCapabilities(driver, true); + } } ret = virObjectRef(driver->caps);