Hello Libvirt community,
I want to apologize for my attempts to send the same patches multiple times, but for some reason I am not able to send Patch 1-2 along with cover letter with this patch set through git send-email.
I even tried sending them separately but it didn’t help.
When I’m trying sending Patch set(0-9), only Patches 3-9 are being successfully sent to mailing list and I’m getting the message on my gmail account that your message to libvir-list@xxxxxxxxxx has been blocked.
I’m still trying to solve this issue but I would appreciate any suggestion on this matter.
Thanks,
Prakhar Bansal
On Sat, Sep 5, 2020 at 2:31 PM <libvir-list-request@xxxxxxxxxx> wrote:
Send libvir-list mailing list submissions to
libvir-list@xxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
https://www.redhat.com/mailman/listinfo/libvir-list
or, via email, send a message with subject or body 'help' to
libvir-list-request@xxxxxxxxxx
You can reach the person managing the list at
libvir-list-owner@xxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of libvir-list digest..."
Today's Topics:
1. [GSoC PATCH 6/9] Jailhouse driver: Implementation of
DomainLookup* callbacks (Prakhar Bansal)
2. [GSoC PATCH 5/9] Jailhouse driver: Implementation of
DomainInfo/State/List (Prakhar Bansal)
3. [GSoC PATCH 7/9] Jailhouse driver: Implementation of
DomainShutdown/Destroy callbacks (Prakhar Bansal)
----------------------------------------------------------------------
Message: 1
Date: Sat, 5 Sep 2020 16:30:00 -0500
From: Prakhar Bansal <prakharbansal0910@xxxxxxxxx>
To: libvir-list@xxxxxxxxxx
Subject: [GSoC PATCH 6/9] Jailhouse driver: Implementation of
DomainLookup* callbacks
Message-ID: <20200905213003.10682-7-prakharbansal0910@xxxxxxxxx>
Content-Type: text/plain; charset=US-ASCII
Signed-off-by:Prakhar Bansal<prakharbansal0910@xxxxxxxxx>
---
src/jailhouse/jailhouse_driver.c | 70 ++++++++++++++++++++++++++++----
1 file changed, 61 insertions(+), 9 deletions(-)
diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_driver.c
index 2bb249f996..8c84a23388 100644
--- a/src/jailhouse/jailhouse_driver.c
+++ b/src/jailhouse/jailhouse_driver.c
@@ -292,25 +292,77 @@ jailhouseConnectListAllDomains(virConnectPtr conn,
static virDomainPtr
jailhouseDomainLookupByID(virConnectPtr conn, int id)
{
- UNUSED(conn);
- UNUSED(id);
- return NULL;
+virJailhouseDriverPtr driver = conn->privateData;
+ virDomainObjPtr cell;
+ virDomainPtr dom = NULL;
+
+ cell = virDomainObjListFindByID(driver->domains, id);
+
+ if (!cell) {
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching ID '%d'"), id);
+ goto cleanup;
+ }
+
+ if (virDomainLookupByIDEnsureACL(conn, cell->def) < 0)
+ goto cleanup;
+
+ dom = virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def->id);
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return dom;
}
static virDomainPtr
jailhouseDomainLookupByName(virConnectPtr conn, const char *name)
{
- UNUSED(conn);
- UNUSED(name);
- return NULL;
+ virJailhouseDriverPtr driver = conn->privateData;
+ virDomainObjPtr cell;
+ virDomainPtr dom = NULL;
+
+ cell = virDomainObjListFindByName(driver->domains, name);
+
+ if (!cell) {
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching name '%s'"), name);
+ goto cleanup;
+ }
+
+ if (virDomainLookupByNameEnsureACL(conn, cell->def) < 0)
+ goto cleanup;
+
+ dom = virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def->id);
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return dom;
}
static virDomainPtr
jailhouseDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{
- UNUSED(conn);
- UNUSED(uuid);
- return NULL;
+ virJailhouseDriverPtr driver = conn->privateData;
+ virDomainObjPtr cell;
+ virDomainPtr dom = NULL;
+
+ cell = virDomainObjListFindByUUID(driver->domains, uuid);
+
+ if (!cell) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(uuid, uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching UUID '%s'"), uuidstr);
+ goto cleanup;
+ }
+
+ if (virDomainLookupByUUIDEnsureACL(conn, cell->def) < 0)
+ goto cleanup;
+
+ dom = virGetDomain(conn, cell->def->name, cell->def->uuid, cell->def->id);
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return dom;
}
static virDomainObjPtr
--
2.17.1
------------------------------
Message: 2
Date: Sat, 5 Sep 2020 16:29:59 -0500
From: Prakhar Bansal <prakharbansal0910@xxxxxxxxx>
To: libvir-list@xxxxxxxxxx
Subject: [GSoC PATCH 5/9] Jailhouse driver: Implementation of
DomainInfo/State/List
Message-ID: <20200905213003.10682-6-prakharbansal0910@xxxxxxxxx>
Content-Type: text/plain; charset=US-ASCII
Signed-off-by:Prakhar Bansal<prakharbansal0910@xxxxxxxxx>
---
src/jailhouse/jailhouse_driver.c | 102 +++++++++++++++++++++++++------
1 file changed, 83 insertions(+), 19 deletions(-)
diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_driver.c
index 5b7bdc92d8..2bb249f996 100644
--- a/src/jailhouse/jailhouse_driver.c
+++ b/src/jailhouse/jailhouse_driver.c
@@ -267,19 +267,26 @@ static int
jailhouseNodeGetInfo(virConnectPtr conn,
virNodeInfoPtr nodeinfo)
{
- UNUSED(conn);
- UNUSED(nodeinfo);
- return -1;
+ if (virNodeGetInfoEnsureACL(conn) < 0)
+ return -1;
+
+ return virCapabilitiesGetNodeInfo(nodeinfo);
}
static int
jailhouseConnectListAllDomains(virConnectPtr conn,
- virDomainPtr **domain, unsigned int flags)
+ virDomainPtr **domains,
+ unsigned int flags)
{
- UNUSED(conn);
- UNUSED(domain);
- UNUSED(flags);
- return -1;
+ virJailhouseDriverPtr driver = conn->privateData;
+
+ virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
+
+ if (virConnectListAllDomainsEnsureACL(conn) < 0)
+ return -1;
+
+ return virDomainObjListExport(driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
static virDomainPtr
@@ -522,30 +529,87 @@ jailhouseDomainDestroy(virDomainPtr domain)
}
static int
-jailhouseDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
+virjailhouseGetDomainTotalCpuStats(virDomainObjPtr cell,
+ unsigned long long *cpustats)
{
- UNUSED(domain);
- UNUSED(info);
+ // TODO(Prakhar): Not implemented yet.
+ UNUSED(cell);
+ UNUSED(cpustats);
return -1;
}
+static int
+jailhouseDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
+{
+ virDomainObjPtr cell;
+ int ret = -1;
+
+ if (!(cell = virJailhouseDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainGetInfoEnsureACL(domain->conn, cell->def) < 0)
+ goto cleanup;
+
+ if (virDomainObjIsActive(cell)) {
+ if (virjailhouseGetDomainTotalCpuStats(cell, &(info->cpuTime)) < 0)
+ goto cleanup;
+ } else {
+ info->cpuTime = 0;
+ }
+
+ info->state = virDomainObjGetState(cell, NULL);
+ info->maxMem = virDomainDefGetMemoryTotal(cell->def);
+ info->nrVirtCpu = virDomainDefGetVcpus(cell->def);
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return ret;
+}
+
static int
jailhouseDomainGetState(virDomainPtr domain,
int *state, int *reason, unsigned int flags)
{
- UNUSED(domain);
- UNUSED(state);
- UNUSED(reason);
- UNUSED(flags);
- return -1;
+ virDomainObjPtr cell;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(cell = virJailhouseDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainGetStateEnsureACL(domain->conn, cell->def) < 0)
+ goto cleanup;
+
+ *state = virDomainObjGetState(cell, reason);
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return ret;
}
static char *
jailhouseDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
{
- UNUSED(domain);
- UNUSED(flags);
- return NULL;
+ virDomainObjPtr cell;
+ char *ret = NULL;
+
+ virCheckFlags(VIR_DOMAIN_XML_COMMON_FLAGS, NULL);
+
+ if (!(cell = virJailhouseDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainGetXMLDescEnsureACL(domain->conn, cell->def, flags) < 0)
+ goto cleanup;
+
+ ret = virDomainDefFormat(cell->def, NULL /* xmlopt */,
+ virDomainDefFormatConvertXMLFlags(flags));
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return ret;
}
static virHypervisorDriver jailhouseHypervisorDriver = {
--
2.17.1
------------------------------
Message: 3
Date: Sat, 5 Sep 2020 16:30:01 -0500
From: Prakhar Bansal <prakharbansal0910@xxxxxxxxx>
To: libvir-list@xxxxxxxxxx
Subject: [GSoC PATCH 7/9] Jailhouse driver: Implementation of
DomainShutdown/Destroy callbacks
Message-ID: <20200905213003.10682-8-prakharbansal0910@xxxxxxxxx>
Content-Type: text/plain; charset=US-ASCII
Signed-off-by:Prakhar Bansal<prakharbansal0910@xxxxxxxxx>
---
src/jailhouse/jailhouse_api.c | 8 +++
src/jailhouse/jailhouse_driver.c | 101 +++++++++++++++++++++++++++++--
2 files changed, 104 insertions(+), 5 deletions(-)
diff --git a/src/jailhouse/jailhouse_api.c b/src/jailhouse/jailhouse_api.c
index 783903e939..510e2f5f66 100644
--- a/src/jailhouse/jailhouse_api.c
+++ b/src/jailhouse/jailhouse_api.c
@@ -71,6 +71,14 @@ int cell_match(const struct dirent *dirent);
int createCell(const char *conf_file);
+int loadImagesInCell(virJailhouseCellId cell_id, char *images, int num_images);
+
+int shutdownCell(virJailhouseCellId cell_id);
+
+int startCell(virJailhouseCellId cell_id);
+
+int destroyCell(virJailhouseCellId cell_id);
+
int getCellInfo(const unsigned int id,
virJailhouseCellInfoPtr * cell_info);
diff --git a/src/jailhouse/jailhouse_driver.c b/src/jailhouse/jailhouse_driver.c
index 8c84a23388..46c7759cb8 100644
--- a/src/jailhouse/jailhouse_driver.c
+++ b/src/jailhouse/jailhouse_driver.c
@@ -406,8 +406,8 @@ jailhouseDomainCreateWithFlags(virDomainPtr domain,
unsigned int flags)
{
virJailhouseDriverPtr driver = domain->conn->privateData;
- virDomainObjPtr cell;
virJailhouseCellInfoPtr cell_info;
+ virDomainObjPtr cell;
int ret = -1;
virCheckFlags(VIR_DOMAIN_NONE, -1);
@@ -566,18 +566,107 @@ jailhouseDomainCreateXML(virConnectPtr conn,
return dom;
}
+static int
+jailhouseDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
+{
+ virJailhouseDriverPtr driver = domain->conn->privateData;
+ virJailhouseCellInfoPtr cell_info;
+ virDomainObjPtr cell;
+ virJailhouseCellId cell_id;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(cell = virJailhouseDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainShutdownFlagsEnsureACL(domain->conn, cell->def, flags) < 0)
+ goto cleanup;
+
+ if (virDomainObjGetState(cell, NULL) != VIR_DOMAIN_RUNNING)
+ goto cleanup;
+
+ if (!(cell_info = virJailhouseFindCellByName(driver, cell->def->name))) {
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching name %s and ID %d)"),
+ cell->def->name, cell->def->id);
+ virDomainObjListRemove(driver->domains, cell);
+ goto cleanup;
+ }
+
+ // Initialize the cell_id.
+ cell_id.id = cell->def->id;
+ cell_id.padding = 0;
+ if (virStrcpy(cell_id.name, cell->def->name, JAILHOUSE_CELL_ID_NAMELEN) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cell name %s length exceeded the limit"),
+ cell->def->name);
+ goto cleanup;
+ }
+
+ if (shutdownCell(cell_id) < 0)
+ goto cleanup;
+
+ virDomainObjSetState(cell, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
+
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return ret;
+}
+
static int
jailhouseDomainShutdown(virDomainPtr domain)
{
- UNUSED(domain);
- return -1;
+ return jailhouseDomainShutdownFlags(domain, 0);
+}
+
+static int
+jailhouseDomainDestroyFlags(virDomainPtr domain, unsigned int flags)
+{
+ virJailhouseDriverPtr driver = domain->conn->privateData;
+ virJailhouseCellInfoPtr cell_info;
+ virDomainObjPtr cell;
+ int ret = -1;
+
+ virCheckFlags(0, -1);
+
+ if (!(cell = virJailhouseDomObjFromDomain(domain)))
+ goto cleanup;
+
+ if (virDomainDestroyFlagsEnsureACL(domain->conn, cell->def) < 0)
+ goto cleanup;
+
+ if (virDomainObjGetState(cell, NULL) != VIR_DOMAIN_SHUTOFF) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("Domain %s is still running."),
+ cell->def->name);
+ goto cleanup;
+ }
+
+ if (!(cell_info = virJailhouseFindCellByName(driver, cell->def->name))) {
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching name %s and ID %d)"),
+ cell->def->name, cell->def->id);
+ virDomainObjListRemove(driver->domains, cell);
+ goto cleanup;
+ }
+
+ // Remove the cell from the domain list.
+ virDomainObjListRemove(driver->domains, cell);
+
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&cell);
+ return ret;
}
static int
jailhouseDomainDestroy(virDomainPtr domain)
{
- UNUSED(domain);
- return -1;
+ return jailhouseDomainDestroyFlags(domain, 0);
}
static int
@@ -675,7 +764,9 @@ static virHypervisorDriver jailhouseHypervisorDriver = {
.domainCreateWithFlags = jailhouseDomainCreateWithFlags, /* 6.3.0 */
.domainCreateXML = jailhouseDomainCreateXML, /* 6.3.0 */
.domainShutdown = jailhouseDomainShutdown, /* 6.3.0 */
+ .domainShutdownFlags = jailhouseDomainShutdownFlags, /* 6.3.0 */
.domainDestroy = jailhouseDomainDestroy, /* 6.3.0 */
+ .domainDestroyFlags = jailhouseDomainDestroyFlags, /* 6.3.0 */
.domainGetInfo = jailhouseDomainGetInfo, /* 6.3.0 */
.domainGetState = jailhouseDomainGetState, /* 6.3.0 */
.domainLookupByID = jailhouseDomainLookupByID, /* 6.3.0 */
--
2.17.1
End of libvir-list Digest, Vol 178, Issue 70
********************************************