diff mbox series

[v2] tools/xl: use libxl_domain_info to get domain type for vcpu-pin

Message ID 1554811318-1931-1-git-send-email-igor.druzhinin@citrix.com (mailing list archive)
State New, archived
Headers show
Series [v2] tools/xl: use libxl_domain_info to get domain type for vcpu-pin | expand

Commit Message

Igor Druzhinin April 9, 2019, 12:01 p.m. UTC
Parsing the config seems to be an overkill for this particular task
and the config might simply be absent. Type returned from libxl_domain_info
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 | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Wei Liu April 9, 2019, 12:36 p.m. UTC | #1
On Tue, Apr 09, 2019 at 01:01:58PM +0100, Igor Druzhinin wrote:
> Parsing the config seems to be an overkill for this particular task
> and the config might simply be absent. Type returned from libxl_domain_info
> 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>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox series

Patch

diff --git a/tools/xl/xl_vcpu.c b/tools/xl/xl_vcpu.c
index 71d3a5c..93abcc6 100644
--- a/tools/xl/xl_vcpu.c
+++ b/tools/xl/xl_vcpu.c
@@ -79,7 +79,6 @@  void apply_global_affinity_masks(libxl_domain_type type,
 
     switch (type) {
     case LIBXL_DOMAIN_TYPE_HVM:
-    case LIBXL_DOMAIN_TYPE_PVH:
         type_mask = &global_hvm_affinity_mask;
         break;
     case LIBXL_DOMAIN_TYPE_PV:
@@ -284,19 +283,15 @@  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);
+        /* HVM and PVH domains use the same global affinity mask */
+        apply_global_affinity_masks(dominfo.domain_type, hard, 1);
     }
 
     if (force) {