get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/29579/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 29579,
    "url": "https://patches.dpdk.org/api/patches/29579/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1507108515-186477-4-git-send-email-david.hunt@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1507108515-186477-4-git-send-email-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1507108515-186477-4-git-send-email-david.hunt@intel.com",
    "date": "2017-10-04T09:15:09",
    "name": "[dpdk-dev,v4,3/9] examples/vm_power_mgr: add vcpu to pcpu mapping",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b1a84bd99ecadee3aaeeebe7dd076f9a42fb5ff2",
    "submitter": {
        "id": 342,
        "url": "https://patches.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1507108515-186477-4-git-send-email-david.hunt@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/29579/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/29579/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DCD121B60D;\n\tWed,  4 Oct 2017 11:55:39 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id BC9F61B632\n\tfor <dev@dpdk.org>; Wed,  4 Oct 2017 11:55:37 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Oct 2017 02:55:37 -0700",
            "from silpixa00397898.ir.intel.com (HELO\n\tsilpixa00397898.ger.corp.intel.com) ([10.237.223.116])\n\tby fmsmga006.fm.intel.com with ESMTP; 04 Oct 2017 02:55:35 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.42,477,1500966000\"; d=\"scan'208\";a=\"159205604\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "konstantin.ananyev@intel.com, jingjing.wu@intel.com,\n\tDavid Hunt <david.hunt@intel.com>,\n\tNemanja Marjanovic <nemanja.marjanovic@intel.com>,\n\tRory Sexton <rory.sexton@intel.com>",
        "Date": "Wed,  4 Oct 2017 10:15:09 +0100",
        "Message-Id": "<1507108515-186477-4-git-send-email-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1507108515-186477-1-git-send-email-david.hunt@intel.com>",
        "References": "<1506342429-199695-1-git-send-email-david.hunt@intel.com>\n\t<1507108515-186477-1-git-send-email-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 3/9] examples/vm_power_mgr: add vcpu to pcpu\n\tmapping",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>\nSigned-off-by: Rory Sexton <rory.sexton@intel.com>\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n examples/vm_power_manager/channel_manager.c | 62 +++++++++++++++++++++++++++++\n examples/vm_power_manager/channel_manager.h | 25 ++++++++++++\n 2 files changed, 87 insertions(+)",
    "diff": "diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c\nindex e068ae2..03fa626 100644\n--- a/examples/vm_power_manager/channel_manager.c\n+++ b/examples/vm_power_manager/channel_manager.c\n@@ -574,6 +574,68 @@ set_channel_status(const char *vm_name, unsigned *channel_list,\n \treturn num_channels_changed;\n }\n \n+void\n+get_all_vm(int *num_vm, int *num_cpu)\n+{\n+\n+\tvirNodeInfo node_info;\n+\tvirDomainPtr *domptr;\n+\tuint64_t mask;\n+\tint i, ii, numVcpus[MAX_VCPUS], cpu, n_vcpus;\n+\tunsigned int jj;\n+\tconst char *vm_name;\n+\tunsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING |\n+\t\t\t\tVIR_CONNECT_LIST_DOMAINS_PERSISTENT;\n+\tunsigned int flag = VIR_DOMAIN_VCPU_CONFIG;\n+\n+\n+\tmemset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen);\n+\tif (virNodeGetInfo(global_vir_conn_ptr, &node_info))\n+\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Unable to retrieve node Info\\n\");\n+\n+\t/* Returns number of pcpus */\n+\tglobal_n_host_cpus = (unsigned int)node_info.cpus;\n+\n+\t/* Returns number of active domains */\n+\t*num_vm = virConnectListAllDomains(global_vir_conn_ptr, &domptr, flags);\n+\tif (*num_vm <= 0)\n+\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"No Active Domains Running\\n\");\n+\n+\tfor (i = 0; i < *num_vm; i++) {\n+\n+\t\t/* Get Domain Names */\n+\t\tvm_name = virDomainGetName(domptr[i]);\n+\t\tlvm_info[i].vm_name = vm_name;\n+\n+\t\t/* Get Number of Vcpus */\n+\t\tnumVcpus[i] = virDomainGetVcpusFlags(domptr[i], flag);\n+\n+\t\t/* Get Number of VCpus & VcpuPinInfo */\n+\t\tn_vcpus = virDomainGetVcpuPinInfo(domptr[i],\n+\t\t\t\tnumVcpus[i], global_cpumaps,\n+\t\t\t\tglobal_maplen, flag);\n+\n+\t\tif ((int)n_vcpus > 0) {\n+\t\t\t*num_cpu = n_vcpus;\n+\t\t\tlvm_info[i].num_cpus = n_vcpus;\n+\t\t}\n+\n+\t\t/* Save pcpu in use by libvirt VMs */\n+\t\tfor (ii = 0; ii < n_vcpus; ii++) {\n+\t\t\tmask = 0;\n+\t\t\tfor (jj = 0; jj < global_n_host_cpus; jj++) {\n+\t\t\t\tif (VIR_CPU_USABLE(global_cpumaps,\n+\t\t\t\t\t\tglobal_maplen, ii, jj) > 0) {\n+\t\t\t\t\tmask |= 1ULL << jj;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tITERATIVE_BITMASK_CHECK_64(mask, cpu) {\n+\t\t\t\tlvm_info[i].pcpus[ii] = cpu;\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n int\n get_info_vm(const char *vm_name, struct vm_info *info)\n {\ndiff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h\nindex 47c3b9c..788c1e6 100644\n--- a/examples/vm_power_manager/channel_manager.h\n+++ b/examples/vm_power_manager/channel_manager.h\n@@ -66,6 +66,17 @@ struct sockaddr_un _sockaddr_un;\n #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path)\n #endif\n \n+#define MAX_VMS 4\n+#define MAX_VCPUS 20\n+\n+\n+struct libvirt_vm_info {\n+\tconst char *vm_name;\n+\tunsigned int pcpus[MAX_VCPUS];\n+\tuint8_t num_cpus;\n+};\n+\n+struct libvirt_vm_info lvm_info[MAX_VMS];\n /* Communication Channel Status */\n enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0,\n \tCHANNEL_MGR_CHANNEL_CONNECTED,\n@@ -319,6 +330,20 @@ int set_channel_status(const char *vm_name, unsigned *channel_list,\n  */\n int get_info_vm(const char *vm_name, struct vm_info *info);\n \n+/**\n+ * Populates a table with all domains running and their physical cpu.\n+ * All information is gathered through libvirt api.\n+ *\n+ * @param noVms\n+ *  modified to store number of active VMs\n+ *\n+ * @param noVcpus\n+    modified to store number of vcpus active\n+ *\n+ * @return\n+ *   void\n+ */\n+void get_all_vm(int *noVms, int *noVcpus);\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "3/9"
    ]
}