Skip to contentSkip to conversation

tools/xendomains: Restrict domid pattern in LIST_GREP

PATCH In review Peter Hoyes 4 participants 4 messages Oct 3, 2022 – Oct 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xendomains: Restrict domid pattern in LIST_GREP

From: Peter Hoyes <[email protected]>

The xendomains script uses the output of xl list -l to collect the id and name of each domain, which is used in the shutdown logic, amongst other purposes.

The linked commit added a "domid" field to libxl_domain_create_info. This causes the output of xl list -l to contain two "domid"s per domain, which may not be equal. This in turn causes xendomains stop to issue two shutdown commands per domain, one of which is to a duplicate and/or invalid domid.

To work around this, make the LIST_GREP pattern more restrictive for domid, so it only detects the domid at the top level and not the domid inside c_info.

Fixes 4a3a25678d92 ("libxl: allow creation of domains with a specified

or random domid")

---
 tools/hotplug/Linux/xendomains.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/Linux/xendomains.in +1 -1
index 334d244882..70f4129ef4 100644
@@ -211,7 +211,7 @@ get_xsdomid()
     fi
 }
 
-LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|^        "domid":'
 parseln()
 {
     if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Gentil ping on this one as it might be a suitable one for 4.17

Cheers
Bertrand

Quoted 41 lines · Peter Hoyes

From: Peter Hoyes <[email protected]>

The xendomains script uses the output of xl list -l to collect the id and name of each domain, which is used in the shutdown logic, amongst other purposes.

The linked commit added a "domid" field to libxl_domain_create_info. This causes the output of xl list -l to contain two "domid"s per domain, which may not be equal. This in turn causes xendomains stop to issue two shutdown commands per domain, one of which is to a duplicate and/or invalid domid.

To work around this, make the LIST_GREP pattern more restrictive for domid, so it only detects the domid at the top level and not the domid inside c_info.

Fixes 4a3a25678d92 ("libxl: allow creation of domains with a specified

or random domid")

---
tools/hotplug/Linux/xendomains.in | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/Linux/xendomains.in +1 -1
index 334d244882..70f4129ef4 100644
@@ -211,7 +211,7 @@ get_xsdomid()
    fi
 }
 
-LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|^        "domid":'
 parseln()
 {
    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
Signature · 1 line
2.25.1
#2 lore raw
Quoted 3 lines · Bertrand Marquis

Hi,

Gentil ping on this one as it might be a suitable one for 4.17

Yeah, that might be a good bug fix to have.

Quoted 13 lines
Quoted 13 lines · Peter Hoyes

From: Peter Hoyes <[email protected]>

The xendomains script uses the output of xl list -l to collect the id and name of each domain, which is used in the shutdown logic, amongst other purposes.

The linked commit added a "domid" field to libxl_domain_create_info. This causes the output of xl list -l to contain two "domid"s per domain, which may not be equal. This in turn causes xendomains stop to issue two shutdown commands per domain, one of which is to a duplicate and/or invalid domid.

Quoted 7 lines
Quoted 7 lines

To work around this, make the LIST_GREP pattern more restrictive for domid, so it only detects the domid at the top level and not the domid inside c_info.

Fixes 4a3a25678d92 ("libxl: allow creation of domains with a specified

or random domid")

Parsing json with bash, grep and sed, what could go wrong :-). Anyway, patch looks fine:

Thanks,

Signature · 1 line
Anthony PERARD
#3 lore raw

Hi,

Quoted 10 lines

-----Original Message-----
From: Anthony PERARD <[email protected]>
Subject: Re: [PATCH] tools/xendomains: Restrict domid pattern in LIST_GREP

Quoted 3 lines · Bertrand Marquis

Hi,

Gentil ping on this one as it might be a suitable one for 4.17

Yeah, that might be a good bug fix to have.

Agreed.

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines · Peter Hoyes

From: Peter Hoyes <[email protected]>

The xendomains script uses the output of xl list -l to collect the id and name of each domain, which is used in the shutdown logic,

amongst

Quoted 5 lines
Quoted 5 lines

other purposes.

The linked commit added a "domid" field to libxl_domain_create_info. This causes the output of xl list -l to contain two "domid"s per domain, which may not be equal. This in turn causes xendomains stop

to

Quoted 1 line
Quoted 1 line

issue two shutdown commands per domain, one of which is to a

duplicate

Quoted 6 lines
Quoted 6 lines

and/or invalid domid.

To work around this, make the LIST_GREP pattern more restrictive for domid, so it only detects the domid at the top level and not the domid inside c_info.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Fixes 4a3a25678d92 ("libxl: allow creation of domains with a specified

or random domid")

Parsing json with bash, grep and sed, what could go wrong :-). Anyway, patch looks fine:

Kind regards,
Henry

Quoted 5 lines

Thanks,

--
Anthony PERARD