get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 45431,
    "url": "http://patches.dpdk.org/api/patches/45431/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180926163727.47337-2-david.hunt@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20180926163727.47337-2-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180926163727.47337-2-david.hunt@intel.com",
    "date": "2018-09-26T16:37:18",
    "name": "[v5,01/10] examples/power: add checks around hypervisor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "647455fda684d6f98f3a1e56cd612a1811766c11",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180926163727.47337-2-david.hunt@intel.com/mbox/",
    "series": [
        {
            "id": 1524,
            "url": "http://patches.dpdk.org/api/series/1524/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1524",
            "date": "2018-09-26T16:37:19",
            "name": "add json power policy interface for containers",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/1524/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/45431/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/45431/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 11BDE1B478;\n\tWed, 26 Sep 2018 18:43:20 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 273D51B437\n\tfor <dev@dpdk.org>; Wed, 26 Sep 2018 18:43:09 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t26 Sep 2018 09:43:06 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.223.64])\n\tby fmsmga006.fm.intel.com with ESMTP; 26 Sep 2018 09:37:30 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,306,1534834800\"; d=\"scan'208\";a=\"266907072\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "john.mcnamara@intel.com, stephen@networkplumber.org, lei.a.yao@intel.com,\n\tanatoly.burakov@intel.com, David Hunt <david.hunt@intel.com>",
        "Date": "Wed, 26 Sep 2018 17:37:18 +0100",
        "Message-Id": "<20180926163727.47337-2-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180926163727.47337-1-david.hunt@intel.com>",
        "References": "<20180926134037.43606-1-david.hunt@intel.com>\n\t<20180926163727.47337-1-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 01/10] examples/power: add checks around\n\thypervisor",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Allow vm_power_manager to run without requiring qemu to be present\non the machine. This will be required for instances where the JSON\ninterface is used for commands and polices, without any VMs present.\nA use case for this is a container enviromnent.\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n examples/vm_power_manager/channel_manager.c | 71 +++++++++++++--------\n 1 file changed, 43 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c\nindex 927fc35ab..2e471d0c1 100644\n--- a/examples/vm_power_manager/channel_manager.c\n+++ b/examples/vm_power_manager/channel_manager.c\n@@ -43,7 +43,8 @@ static unsigned char *global_cpumaps;\n static virVcpuInfo *global_vircpuinfo;\n static size_t global_maplen;\n \n-static unsigned global_n_host_cpus;\n+static unsigned int global_n_host_cpus;\n+static bool global_hypervisor_available;\n \n /*\n  * Represents a single Virtual Machine\n@@ -198,7 +199,11 @@ get_pcpus_mask(struct channel_info *chan_info, unsigned vcpu)\n {\n \tstruct virtual_machine_info *vm_info =\n \t\t\t(struct virtual_machine_info *)chan_info->priv_info;\n-\treturn rte_atomic64_read(&vm_info->pcpu_mask[vcpu]);\n+\n+\tif (global_hypervisor_available && (vm_info != NULL))\n+\t\treturn rte_atomic64_read(&vm_info->pcpu_mask[vcpu]);\n+\telse\n+\t\treturn 0;\n }\n \n static inline int\n@@ -559,6 +564,8 @@ get_all_vm(int *num_vm, int *num_vcpu)\n \t\t\t\tVIR_CONNECT_LIST_DOMAINS_PERSISTENT;\n \tunsigned int domain_flag = VIR_DOMAIN_VCPU_CONFIG;\n \n+\tif (!global_hypervisor_available)\n+\t\treturn;\n \n \tmemset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen);\n \tif (virNodeGetInfo(global_vir_conn_ptr, &node_info)) {\n@@ -768,38 +775,42 @@ connect_hypervisor(const char *path)\n \t}\n \treturn 0;\n }\n-\n int\n-channel_manager_init(const char *path)\n+channel_manager_init(const char *path __rte_unused)\n {\n \tvirNodeInfo info;\n \n \tLIST_INIT(&vm_list_head);\n \tif (connect_hypervisor(path) < 0) {\n-\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Unable to initialize channel manager\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tglobal_maplen = VIR_CPU_MAPLEN(CHANNEL_CMDS_MAX_CPUS);\n+\t\tglobal_n_host_cpus = 64;\n+\t\tglobal_hypervisor_available = 0;\n+\t\tRTE_LOG(INFO, CHANNEL_MANAGER, \"Unable to initialize channel manager\\n\");\n+\t} else {\n+\t\tglobal_hypervisor_available = 1;\n+\n+\t\tglobal_maplen = VIR_CPU_MAPLEN(CHANNEL_CMDS_MAX_CPUS);\n+\n+\t\tglobal_vircpuinfo = rte_zmalloc(NULL,\n+\t\t\t\tsizeof(*global_vircpuinfo) *\n+\t\t\t\tCHANNEL_CMDS_MAX_CPUS, RTE_CACHE_LINE_SIZE);\n+\t\tif (global_vircpuinfo == NULL) {\n+\t\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Error allocating memory for CPU Info\\n\");\n+\t\t\tgoto error;\n+\t\t}\n+\t\tglobal_cpumaps = rte_zmalloc(NULL,\n+\t\t\t\tCHANNEL_CMDS_MAX_CPUS * global_maplen,\n+\t\t\t\tRTE_CACHE_LINE_SIZE);\n+\t\tif (global_cpumaps == NULL)\n+\t\t\tgoto error;\n \n-\tglobal_vircpuinfo = rte_zmalloc(NULL, sizeof(*global_vircpuinfo) *\n-\t\t\tCHANNEL_CMDS_MAX_CPUS, RTE_CACHE_LINE_SIZE);\n-\tif (global_vircpuinfo == NULL) {\n-\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Error allocating memory for CPU Info\\n\");\n-\t\tgoto error;\n-\t}\n-\tglobal_cpumaps = rte_zmalloc(NULL, CHANNEL_CMDS_MAX_CPUS * global_maplen,\n-\t\t\tRTE_CACHE_LINE_SIZE);\n-\tif (global_cpumaps == NULL) {\n-\t\tgoto error;\n+\t\tif (virNodeGetInfo(global_vir_conn_ptr, &info)) {\n+\t\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Unable to retrieve node Info\\n\");\n+\t\t\tgoto error;\n+\t\t}\n+\t\tglobal_n_host_cpus = (unsigned int)info.cpus;\n \t}\n \n-\tif (virNodeGetInfo(global_vir_conn_ptr, &info)) {\n-\t\tRTE_LOG(ERR, CHANNEL_MANAGER, \"Unable to retrieve node Info\\n\");\n-\t\tgoto error;\n-\t}\n \n-\tglobal_n_host_cpus = (unsigned)info.cpus;\n \n \tif (global_n_host_cpus > CHANNEL_CMDS_MAX_CPUS) {\n \t\tRTE_LOG(WARNING, CHANNEL_MANAGER, \"The number of host CPUs(%u) exceeds the \"\n@@ -811,7 +822,8 @@ channel_manager_init(const char *path)\n \n \treturn 0;\n error:\n-\tdisconnect_hypervisor();\n+\tif (global_hypervisor_available)\n+\t\tdisconnect_hypervisor();\n \treturn -1;\n }\n \n@@ -838,7 +850,10 @@ channel_manager_exit(void)\n \t\trte_free(vm_info);\n \t}\n \n-\trte_free(global_cpumaps);\n-\trte_free(global_vircpuinfo);\n-\tdisconnect_hypervisor();\n+\tif (global_hypervisor_available) {\n+\t\t/* Only needed if hypervisor available */\n+\t\trte_free(global_cpumaps);\n+\t\trte_free(global_vircpuinfo);\n+\t\tdisconnect_hypervisor();\n+\t}\n }\n",
    "prefixes": [
        "v5",
        "01/10"
    ]
}