Skip to contentSkip to conversation

Xendomains was not correctly suspending domains when a STOP was issued.

PATCH In review Ian Murray 3 participants 12 messages Jun 22, 2013 – Jun 27, 2013

lore
Share & tools
lore

Ian Murray

author
#0 lore raw

PATCH 1/1 Xendomains was not correctly suspending domains when a STOP was issued.

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

This has now been tested against 4.3RC5

---
 tools/hotplug/Linux/init.d/xendomains |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/hotplug/Linux/init.d/xendomains +5 -5
index 730541e..38371af 100644
@@ -206,7 +206,7 @@ rdnames()
     done
 }
 
-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
 parseln()
 {
     if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
@@ -237,7 +237,7 @@ is_running()
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return $RC
 }
 
@@ -319,7 +319,7 @@ all_zombies()
 	if test "$state" != "-b---d" -a "$state" != "-----d"; then
 	    return 1;
 	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return 0
 }
 
@@ -450,7 +450,7 @@ stop()
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return 1
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Ian Murray

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Quoted 6 lines

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

This has now been tested against 4.3RC5

IanC, is this a candidate for 4.3?

-George

author
#2 lore raw

----- Original Message -----

Quoted 5 lines

From: George Dunlap <[email protected]>
To: Ian Murray <[email protected]>
Cc: Ian Campbell <[email protected]>; "[email protected]" <[email protected]>
Sent: Monday, 24 June 2013, 11:50
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 9 lines · Ian Murray
Quoted 2 lines

  The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP

selected.

Quoted 4 lines

  Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Quoted 8 lines
Quoted 6 lines

  Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

  This has now been tested against 4.3RC5

IanC, is this a candidate for 4.3?

The background to this issue was discussion on a thread entitled "DomU suspension/hibernation" on the user's list, towards the latter end of the thread. The principal behind the patch was discussed by Ian C at 19 Jun 2013 10:51 and afterwards.  Hope that gives a little context.

Quoted 8 lines

-George

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#3 lore raw
In reply to Ian Murray

I was under the impression that this in line for 4.3 RC6 but as of yet, I am not seeing it in git. Maybe it's queued, in which case ignore this or if it's been forgotten, then please don't ignore this. :)

Thanks,

Ian

Quoted 65 lines · Ian Murray

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

This has now been tested against 4.3RC5

---
  tools/hotplug/Linux/init.d/xendomains |   10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
tools/hotplug/Linux/init.d/xendomains +5 -5
index 730541e..38371af 100644
@@ -206,7 +206,7 @@ rdnames()
      done
  }
 
-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
  parseln()
  {
      if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
@@ -237,7 +237,7 @@ is_running()
  		RC=0
  		;;
  	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return $RC
  }
 
@@ -319,7 +319,7 @@ all_zombies()
  	if test "$state" != "-b---d" -a "$state" != "-----d"; then
  	    return 1;
  	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 0
  }
 
@@ -450,7 +450,7 @@ stop()
  	    fi
  	    kill $WDOG_PID >/dev/null 2>&1
  	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
 
      # NB. this shuts down ALL Xen domains (politely), not just the ones in
      # AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()
  		return 0
  		;;
  	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 1
  }
 
#4 lore raw

It's in my queue. I don't know if it will make rc6 but it'll get in.

Quoted 77 lines · Ian Murray

I was under the impression that this in line for 4.3 RC6 but as of yet, I am not seeing it in git. Maybe it's queued, in which case ignore this or if it's been forgotten, then please don't ignore this. :)

Thanks,

Ian

Quoted 65 lines · Ian Murray

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

This has now been tested against 4.3RC5

---
  tools/hotplug/Linux/init.d/xendomains |   10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
tools/hotplug/Linux/init.d/xendomains +5 -5
index 730541e..38371af 100644
@@ -206,7 +206,7 @@ rdnames()
      done
  }
 
-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
  parseln()
  {
      if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
@@ -237,7 +237,7 @@ is_running()
  		RC=0
  		;;
  	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return $RC
  }
 
@@ -319,7 +319,7 @@ all_zombies()
  	if test "$state" != "-b---d" -a "$state" != "-----d"; then
  	    return 1;
  	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 0
  }
 
@@ -450,7 +450,7 @@ stop()
  	    fi
  	    kill $WDOG_PID >/dev/null 2>&1
  	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
 
      # NB. this shuts down ALL Xen domains (politely), not just the ones in
      # AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()
  		return 0
  		;;
  	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 1
  }
 
Acked-by on v1 1/1
#5 lore raw
In reply to Ian Murray
Quoted 10 lines · Ian Murray

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP selected.

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

This has now been tested against 4.3RC5

I also tested on current staging with xl (json), xl (sxp) and xm (sxp) with two domains and it worked fine where previously the xl json case would try and suspend the same domain twice (I didn't bother testing the old case for the other two at that point).

Quoted 1 line

And applied.

Quoted 53 lines
---
 tools/hotplug/Linux/init.d/xendomains |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/hotplug/Linux/init.d/xendomains +5 -5
index 730541e..38371af 100644
@@ -206,7 +206,7 @@ rdnames()
     done
 }
 
-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
 parseln()
 {
     if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
@@ -237,7 +237,7 @@ is_running()
 		RC=0
 		;;
 	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return $RC
 }
 
@@ -319,7 +319,7 @@ all_zombies()
 	if test "$state" != "-b---d" -a "$state" != "-----d"; then
 	    return 1;
 	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return 0
 }
 
@@ -450,7 +450,7 @@ stop()
 	    fi
 	    kill $WDOG_PID >/dev/null 2>&1
 	fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
 
     # NB. this shuts down ALL Xen domains (politely), not just the ones in
     # AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()
 		return 0
 		;;
 	esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
     return 1
 }
 
author
#6 lore raw

----- Original Message -----

Quoted 5 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: [email protected]
Sent: Thursday, 27 June 2013, 12:32
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 12 lines · Ian Murray
Quoted 2 lines

The regex was not selecting the { when parsing JSON output of xl list -l. It was also not selecting (domain when parsing xl list -l when SXP

selected.

Quoted 7 lines

Pefixed { with 4 spaces, and removed an extra ( before domain in the regex string

Added quotes around the grep strings so the spaces inserted into the string didn't not break the grepping.

Quoted 7 lines
Quoted 1 line

This has now been tested against 4.3RC5

I also tested on current staging with xl (json), xl (sxp) and xm (sxp) with two domains and it worked fine where previously the xl json case would try and suspend the same domain twice (I didn't bother testing the old case for the other two at that point).

Thanks. BTW, the JSON output of 4.3 looked the same to me as 4.2.2 (i.e. badly formed), so I am not sure the patch you mentioned to make it well-formed was in as of 4.3 RC5. if/when the well formed patch is introduced (if it isn't already), it may very well break this (xendomains) patch.

Quoted 6 lines
Quoted 1 line

And applied.

Thanks. Have a good release. :)

Quoted 66 lines
Quoted 5 lines

---
  tools/hotplug/Linux/init.d/xendomains |  10 +++++-----

  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xendomains

b/tools/hotplug/Linux/init.d/xendomains

Quoted 8 lines

index 730541e..38371af 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -206,7 +206,7 @@ rdnames()
      done
  }

-LIST_GREP='((domain\|(domid\|(name\|^{$\|"name":\|"domid":'

Quoted 1 line

+LIST_GREP='(domain\|(domid\|(name\|^

{$\|"name":\|"domid":'

Quoted 3 lines

  parseln()
  {
      if [[ "$1" =~ '(domain' ]] || [[ "$1" =

"{" ]]; then

Quoted 11 lines

@@ -237,7 +237,7 @@ is_running()
          RC=0
          ;;
      esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return $RC
  }

@@ -319,7 +319,7 @@ all_zombies()
      if test "$state" != "-b---d" -a "$state"

!= "-----d"; then

Quoted 17 lines

          return 1;
      fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 0
  }

@@ -450,7 +450,7 @@ stop()
          fi
          kill $WDOG_PID >/dev/null 2>&1
      fi
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")

      # NB. this shuts down ALL Xen domains (politely), not just the ones in # AUTODIR/*
@@ -487,7 +487,7 @@ check_domain_up()

Quoted 8 lines

          return 0
          ;;
      esac
-    done < <($CMD list -l | grep $LIST_GREP)
+    done < <($CMD list -l | grep "$LIST_GREP")
      return 1
  }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by Ian Jackson
#7 lore raw
Quoted 5 lines · Ian Murray

Thanks. BTW, the JSON output of 4.3 looked the same to me as 4.2.2 (i.e. badly formed), so I am not sure the patch you mentioned to make it well-formed was in as of 4.3 RC5. if/when the well formed patch is introduced (if it isn't already), it may very well break this (xendomains) patch.

Looks like I was mistaken and that fix was already in 4.2.0 (rc4 to be precise).

commit ac963eb7895b8351017bb6005505c2b176202f0e

Author: Ian Campbell <[email protected]>
Date:   Thu Aug 23 19:12:28 2012 +0100

xl: make "xl list -l" proper JSON

Bastian Blank reports that the output of this command is just multiple JSON objects concatenated and is not a single properly formed JSON object.

Fix this by wrapping in an array. This turned out to be a bit more intrusive than I was expecting due to the requirement to keep supporting the SXP output mode.

Python's json module is happy to parse the result...

Ian.

author
#8 lore raw

----- Original Message -----

Quoted 5 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thursday, 27 June 2013, 12:59
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 10 lines · Ian Murray
Quoted 5 lines

Thanks. BTW, the JSON output of 4.3 looked the same to me as 4.2.2 (i.e. badly formed), so I am not sure the patch you mentioned to make it well-formed was in as of 4.3 RC5.  if/when the well formed patch is introduced (if it isn't already), it may very well break this (xendomains) patch.

Looks like I was mistaken and that fix was already in 4.2.0 (rc4 to be precise).

Yeah, according to http://jsonlint.com/ the output is valid. I thought it needed a left-hand object name to be valid, but it seems I was wrong. Anyway, it'is all good.

Thanks.

p.s. Looks like this patch missed RC6 by 40 minutes. :(

.

Quoted 22 lines

commit ac963eb7895b8351017bb6005505c2b176202f0e
Author: Ian Campbell <[email protected]> Date:  Thu Aug 23 19:12:28 2012 +0100

    xl: make "xl list -l" proper JSON

    Bastian Blank reports that the output of this command is just multiple JSON objects concatenated and is not a single properly formed JSON object.

    Fix this by wrapping in an array. This turned out to be a bit more intrusive than I was expecting due to the requirement to keep supporting the SXP output mode.

    Python's json module is happy to parse the result...

Ian.

#9 lore raw
Quoted 18 lines · Ian Murray

----- Original Message -----

Quoted 5 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thursday, 27 June 2013, 12:59
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 8 lines · Ian Murray
Quoted 5 lines

Thanks. BTW, the JSON output of 4.3 looked the same to me as 4.2.2 (i.e. badly formed), so I am not sure the patch you mentioned to make it well-formed was in as of 4.3 RC5. if/when the well formed patch is introduced (if it isn't already), it may very well break this (xendomains) patch.

Quoted 8 lines
Quoted 2 lines

Looks like I was mistaken and that fix was already in 4.2.0 (rc4 to be precise).

Yeah, according to http://jsonlint.com/ the output is valid. I thought it needed a left-hand object name to be valid, but it seems I was wrong. Anyway, it'is all good.

Thanks.

p.s. Looks like this patch missed RC6 by 40 minutes. :(

Actually rc6 effectively happened last night, since the commits made then needed to pass testing before they could be considered an rc.

Ian.

author
#10 lore raw

----- Original Message -----

Quoted 5 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thursday, 27 June 2013, 13:19
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 32 lines · Ian Murray
Quoted 7 lines

----- Original Message -----

Quoted 3 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]"

<[email protected]>

Quoted 2 lines
Quoted 2 lines

Sent: Thursday, 27 June 2013, 12:59
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly

suspending

Quoted 4 lines

  domains when a STOP was issued.

Quoted 3 lines · Ian Murray
Quoted 1 line

  Thanks. BTW, the JSON output of 4.3 looked the same to me as

4.2.2

Quoted 1 line
Quoted 1 line
Quoted 1 line

  (i.e. badly formed), so I am not sure the patch you mentioned to

make

Quoted 1 line
Quoted 1 line
Quoted 1 line

  it well-formed was in as of 4.3 RC5.  if/when the well formed

patch is

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

  introduced (if it isn't already), it may very well break this (xendomains) patch.

Looks like I was mistaken and that fix was already in 4.2.0 (rc4 to be precise).

Yeah, according to http://jsonlint.com/ the output is valid. I thought it

needed a left-hand object name to be valid, but it seems I was wrong. Anyway, it'is all good.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

Thanks.

p.s. Looks like this patch missed RC6 by 40 minutes. :(

Actually rc6 effectively happened last night, since the commits made then needed to pass testing before they could be considered an rc.

So does that mean this patch will miss 4.3.0 final?

Quoted 3 lines

Ian.

#11 lore raw
Quoted 42 lines · Ian Murray

----- Original Message -----

Quoted 5 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thursday, 27 June 2013, 13:19
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly suspending

domains when a STOP was issued.

Quoted 32 lines · Ian Murray
Quoted 7 lines

----- Original Message -----

Quoted 3 lines

From: Ian Campbell <[email protected]>
To: Ian Murray <[email protected]>
Cc: "[email protected]"

<[email protected]>

Quoted 2 lines
Quoted 2 lines

Sent: Thursday, 27 June 2013, 12:59
Subject: Re: [Xen-devel] [PATCH] Xendomains was not correctly

suspending

Quoted 4 lines

domains when a STOP was issued.

Quoted 3 lines · Ian Murray
Quoted 1 line

Thanks. BTW, the JSON output of 4.3 looked the same to me as

4.2.2

Quoted 1 line
Quoted 1 line
Quoted 1 line

(i.e. badly formed), so I am not sure the patch you mentioned to

make

Quoted 1 line
Quoted 1 line
Quoted 1 line

it well-formed was in as of 4.3 RC5. if/when the well formed

patch is

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

introduced (if it isn't already), it may very well break this (xendomains) patch.

Looks like I was mistaken and that fix was already in 4.2.0 (rc4 to be precise).

Yeah, according to http://jsonlint.com/ the output is valid. I thought it

needed a left-hand object name to be valid, but it seems I was wrong. Anyway, it'is all good.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Thanks.

p.s. Looks like this patch missed RC6 by 40 minutes. :(

Actually rc6 effectively happened last night, since the commits made then needed to pass testing before they could be considered an rc.

So does that mean this patch will miss 4.3.0 final?

No, it'll be in the release.

Quoted 5 lines
Quoted 5 lines

Ian.