All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Druzhinin <igor.druzhinin@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
	Igor Druzhinin <igor.druzhinin@citrix.com>
Subject: [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
Date: Fri, 5 Apr 2019 21:51:48 +0100	[thread overview]
Message-ID: <1554497508-32708-1-git-send-email-igor.druzhinin@citrix.com> (raw)

Parsing the config seems to be an overkill for this particular task
and the config might simply be absent. Type returned should be either
LIBXL_DOMAIN_TYPE_HVM or LIBXL_DOMAIN_TYPE_PV but in that context
distinction between PVH and HVM should be irrelevant.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 71d3a5c..4a4d0fa 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -284,19 +284,14 @@ int main_vcpupin(int argc, char **argv)
 
     /* Only hard affinity matters here */
     if (!ignore_masks) {
-        libxl_domain_config d_config;
+        libxl_dominfo dominfo;
 
-        libxl_domain_config_init(&d_config);
-        rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
-        if (rc) {
-            fprintf(stderr, "Could not retrieve domain configuration\n");
-            libxl_domain_config_dispose(&d_config);
+        if (libxl_domain_info(ctx, &dominfo, domid)) {
+            fprintf(stderr, "Could not get domain info\n");
             goto out;
         }
 
-        apply_global_affinity_masks(d_config.b_info.type, hard, 1);
-
-        libxl_domain_config_dispose(&d_config);
+        apply_global_affinity_masks(dominfo.domain_type, hard, 1);
     }
 
     if (force) {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Igor Druzhinin <igor.druzhinin@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
	Igor Druzhinin <igor.druzhinin@citrix.com>
Subject: [Xen-devel] [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin
Date: Fri, 5 Apr 2019 21:51:48 +0100	[thread overview]
Message-ID: <1554497508-32708-1-git-send-email-igor.druzhinin@citrix.com> (raw)
Message-ID: <20190405205148.5G-ys2OUd47mczJcdeA2tWQ31BxvK27JsPj15omdi-8@z> (raw)

Parsing the config seems to be an overkill for this particular task
and the config might simply be absent. Type returned should be either
LIBXL_DOMAIN_TYPE_HVM or LIBXL_DOMAIN_TYPE_PV but in that context
distinction between PVH and HVM should be irrelevant.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 tools/xl/xl_vcpu.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 71d3a5c..4a4d0fa 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -284,19 +284,14 @@ int main_vcpupin(int argc, char **argv)
 
     /* Only hard affinity matters here */
     if (!ignore_masks) {
-        libxl_domain_config d_config;
+        libxl_dominfo dominfo;
 
-        libxl_domain_config_init(&d_config);
-        rc = libxl_retrieve_domain_configuration(ctx, domid, &d_config);
-        if (rc) {
-            fprintf(stderr, "Could not retrieve domain configuration\n");
-            libxl_domain_config_dispose(&d_config);
+        if (libxl_domain_info(ctx, &dominfo, domid)) {
+            fprintf(stderr, "Could not get domain info\n");
             goto out;
         }
 
-        apply_global_affinity_masks(d_config.b_info.type, hard, 1);
-
-        libxl_domain_config_dispose(&d_config);
+        apply_global_affinity_masks(dominfo.domain_type, hard, 1);
     }
 
     if (force) {
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2019-04-05 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-05 20:51 Igor Druzhinin [this message]
2019-04-05 20:51 ` [Xen-devel] [PATCH] tools/xl: use libxl_domain_info to get domain type for vcpu-pin Igor Druzhinin
2019-04-09  9:40 ` Wei Liu
2019-04-09  9:40   ` [Xen-devel] " Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554497508-32708-1-git-send-email-igor.druzhinin@citrix.com \
    --to=igor.druzhinin@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.