get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44010,
    "url": "http://patches.dpdk.org/api/patches/44010/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180830105422.1198-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": "<20180830105422.1198-2-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180830105422.1198-2-david.hunt@intel.com",
    "date": "2018-08-30T10:54:16",
    "name": "[v1,1/7] examples/power: add checks around hypervisor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5c4592e3333bf9897ea8874d4c9ebd2fe18f1ba5",
    "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/20180830105422.1198-2-david.hunt@intel.com/mbox/",
    "series": [
        {
            "id": 1109,
            "url": "http://patches.dpdk.org/api/series/1109/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1109",
            "date": "2018-08-30T10:54:15",
            "name": "add json power policy interface for containers",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1109/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44010/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44010/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 D25904C9F;\n\tThu, 30 Aug 2018 12:55:00 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 46E742BA3\n\tfor <dev@dpdk.org>; Thu, 30 Aug 2018 12:54:58 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Aug 2018 03:54:57 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.223.64])\n\tby fmsmga004.fm.intel.com with ESMTP; 30 Aug 2018 03:54:56 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,306,1531810800\"; d=\"scan'208\";a=\"84641468\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "john.mcnamara@intel.com,\n\tdavid.hunt@intel.com",
        "Date": "Thu, 30 Aug 2018 11:54:16 +0100",
        "Message-Id": "<20180830105422.1198-2-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180830105422.1198-1-david.hunt@intel.com>",
        "References": "<20180830105422.1198-1-david.hunt@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 1/7] 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 qemy 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>\n---\n examples/vm_power_manager/channel_manager.c | 71 +++++++++++++--------\n examples/vm_power_manager/channel_monitor.c |  2 +-\n 2 files changed, 44 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c\nindex 927fc35ab..2bb8641d3 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 unsigned int 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 }\ndiff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c\nindex 7fa47ba97..f180d74e6 100644\n--- a/examples/vm_power_manager/channel_monitor.c\n+++ b/examples/vm_power_manager/channel_monitor.c\n@@ -66,7 +66,7 @@ static void\n core_share_status(int pNo)\n {\n \n-\tint noVms, noVcpus, z, x, t;\n+\tint noVms = 0, noVcpus = 0, z, x, t;\n \n \tget_all_vm(&noVms, &noVcpus);\n \n",
    "prefixes": [
        "v1",
        "1/7"
    ]
}