Skip to contentSkip to conversation

Toolstack::xl: Support for ACPI fallback for shutdown

PATCH In review Ian Campbell 3 participants 10 messages May 7, 2015 – May 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Toolstack::xl: Support for ACPI fallback for shutdown

HVM guests which do not include PV drivers will not shutdown after a simple "xl shutdown". Add a runvar to indicate that the guest will shutdown in response to an ACPI power event and apply this to the win7 and winxp test jobs.

Tested with:

    test-amd64-amd64-xl-qemuu-winxpsp3
    test-amd64-amd64-xl-qemuu-win7-amd64
    test-amd64-amd64-xl-qemuu-debianhvm-amd64
    test-amd64-amd64-xl

The first two correctly used the extra flag and the domains shutdown, the other two correctly didn't use the extra flag and still shutdown.

Not currently implemented for libvirt, since we currently have no libvirt tests I could try it with.

---
 Osstest/Toolstack/xl.pm | 4 +++-
 make-flight             | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
Osstest/Toolstack/xl.pm +3 -1
index 71aefd5..dd12ae1 100644
@@ -55,7 +55,9 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};
     my $gn = $gho->{Name};
-    target_cmd_root($ho,"$self->{_Command} shutdown -w $gn", $timeout);
+    my $acpi_fallback = guest_var($gho,'acpi_shutdown','false') eq 'true'
+	? "F" : "";
+    target_cmd_root($ho,"$self->{_Command} shutdown -w${acpi_fallback} $gn", $timeout);
 }
 
 sub migrate_check ($) {
make-flight +2 -0
index 70c1900..202c68d 100755
@@ -188,6 +188,7 @@ do_hvm_winxp_tests () {
             test-$xenarch$kern-$dom0arch-$toolstack$qemuu_suffix-winxpsp3$vcpus_suffix \
             test-win $toolstack $xenarch $dom0arch $qemuu_runvar \
             win_image=winxpsp3.iso $vcpus_runvars   \
+            win_acpi_shutdown=true \
             all_hostflags=$most_hostflags,hvm
 
   done
@@ -201,6 +202,7 @@ do_hvm_win7_x64_tests () {
   job_create_test test-$xenarch$kern-$dom0arch-xl$qemuu_suffix-win7-amd64 \
             test-win xl $xenarch $dom0arch $qemuu_runvar \
             win_image=win7-x64.iso \
+            win_acpi_shutdown=true \
             all_hostflags=$most_hostflags,hvm
 }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 11 lines · Ian Campbell

HVM guests which do not include PV drivers will not shutdown after a simple "xl shutdown". Add a runvar to indicate that the guest will shutdown in response to an ACPI power event and apply this to the win7 and winxp test jobs.

Tested with:

    test-amd64-amd64-xl-qemuu-winxpsp3
    test-amd64-amd64-xl-qemuu-win7-amd64
    test-amd64-amd64-xl-qemuu-debianhvm-amd64
    test-amd64-amd64-xl
Quoted 4 lines

The first two correctly used the extra flag and the domains shutdown, the other two correctly didn't use the extra flag and still shutdown. Not currently implemented for libvirt, since we currently have no libvirt tests I could try it with.

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Managing_guest_virtual_machines_with_virsh-Shutting_down_rebooting_and_force_shutdown_of_a_guest_virtual_machine.html
suggests that virsh reboot can take a comma separated list for the --mode option and will try them each in turn.

It doesn't say the same for virsh shutdown but it might be reasonable to assume that this is a docs issue not a functionality one.

If that were the case then I think the below would do the trick, but as I say I don't have an immediately convenient way to test, nor a need since there are no such tests right now.

Ian.

Osstest/Toolstack/libvirt.pm +5 -1
index 8bd7f4f..e7f4860 100644
@@ -60,7 +60,11 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh shutdown $gn", 30);
+    my $mode = "paravirt";
+    $mode .= ",acpi"
+	if guest_var($gho,'acpi_shutdown','false') eq 'true';
+
+    target_cmd_root($ho, "virsh shutdown --mode $mode $gn", 30);
     guest_await_destroy($gho,$timeout);
 }
#2 lore raw

Ian Campbell writes ("Re: [PATCH OSSTEST] Toolstack::xl: Support for ACPI fallback for shutdown"):

Quoted 3 lines

If that were the case then I think the below would do the trick, but as I say I don't have an immediately convenient way to test, nor a need since there are no such tests right now.

This patch looks plausible. Subject to comments from Jim I would be tempted to throw it into osstest alongside the patch to do the same to xl, with appropriate caveats in the commit message.

Ian.

#3 lore raw
Quoted 8 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH OSSTEST] Toolstack::xl: Support for ACPI fallback for shutdown"):

Quoted 3 lines

If that were the case then I think the below would do the trick, but as I say I don't have an immediately convenient way to test, nor a need since there are no such tests right now.

This patch looks plausible. Subject to comments from Jim I would be tempted to throw it into osstest alongside the patch to do the same to xl, with appropriate caveats in the commit message.

Shall I fold it into the xl one, or do it separately?

#4 lore raw
Quoted 11 lines · Ian Campbell
Quoted 8 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH OSSTEST] Toolstack::xl: Support for ACPI fallback for shutdown"):

Quoted 3 lines

If that were the case then I think the below would do the trick, but as I say I don't have an immediately convenient way to test, nor a need since there are no such tests right now.

This patch looks plausible. Subject to comments from Jim I would be tempted to throw it into osstest alongside the patch to do the same to xl, with appropriate caveats in the commit message.

Shall I fold it into the xl one, or do it separately?

You acked the xl one, so here is a separate one.

Jim, does this look at all plausible to you?

Ian.

Quoted 1 line

From f560b7eed781a93567d69bcf90260c7475854766 Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested (but at least should be harmless to current jobs).

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument.

---
 Osstest/Toolstack/libvirt.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +5 -1
index 8bd7f4f..e7f4860 100644
@@ -60,7 +60,11 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh shutdown $gn", 30);
+    my $mode = "paravirt";
+    $mode .= ",acpi"
+	if guest_var($gho,'acpi_shutdown','false') eq 'true';
+
+    target_cmd_root($ho, "virsh shutdown --mode $mode $gn", 30);
     guest_await_destroy($gho,$timeout);
 }
 
Signature · 1 line
2.1.4
#5 lore raw
Quoted 14 lines · Ian Campbell
Quoted 12 lines · Ian Campbell
Quoted 10 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH OSSTEST] Toolstack::xl: Support for ACPI fallback for shutdown"):

Quoted 4 lines

If that were the case then I think the below would do the trick, but as I say I don't have an immediately convenient way to test, nor a need since there are no such tests right now.

This patch looks plausible. Subject to comments from Jim I would be tempted to throw it into osstest alongside the patch to do the same to xl, with appropriate caveats in the commit message.

Quoted 7 lines
Quoted 2 lines

Shall I fold it into the xl one, or do it separately?

You acked the xl one, so here is a separate one.

Jim, does this look at all plausible to you?

Yes, looks good.

Quoted 7 lines

Ian.

From f560b7eed781a93567d69bcf90260c7475854766 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

Quoted 9 lines

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested (but at least should be harmless to current jobs).

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument.

That assumption would be correct, and I just verified it is working as expected.

Regards,
Jim

Quoted 24 lines
---
 Osstest/Toolstack/libvirt.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +5 -1
index 8bd7f4f..e7f4860 100644
@@ -60,7 +60,11 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh shutdown $gn", 30);
+    my $mode = "paravirt";
+    $mode .= ",acpi"
+	if guest_var($gho,'acpi_shutdown','false') eq 'true';
+
+    target_cmd_root($ho, "virsh shutdown --mode $mode $gn", 30);
     guest_await_destroy($gho,$timeout);
 }
 
#6 lore raw
Quoted 12 lines · Jim Fehlig
Quoted 12 lines

Ian.

From f560b7eed781a93567d69bcf90260c7475854766 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested (but at least should be harmless to current jobs).

Quoted 7 lines
Quoted 4 lines

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument.

That assumption would be correct, and I just verified it is working as expected.

Thanks. I updated the commit message to reflect this feedback. Can I add your ack to?

Quoted 1 line

From 682b446b1ee30e6b26b7138805bdd0ca89d1942d Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested in the context of osstest (but at least should be harmless to current jobs).

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument, which Jim has tested and confirmed to be true.

---
 Osstest/Toolstack/libvirt.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +5 -1
index 8bd7f4f..e7f4860 100644
@@ -60,7 +60,11 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh shutdown $gn", 30);
+    my $mode = "paravirt";
+    $mode .= ",acpi"
+	if guest_var($gho,'acpi_shutdown','false') eq 'true';
+
+    target_cmd_root($ho, "virsh shutdown --mode $mode $gn", 30);
     guest_await_destroy($gho,$timeout);
 }
 
Signature · 1 line
2.1.4
#7 lore raw
Quoted 19 lines · Ian Campbell
Quoted 17 lines · Jim Fehlig
Quoted 17 lines

Ian.

From f560b7eed781a93567d69bcf90260c7475854766 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested (but at least should be harmless to current jobs).

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument.

Quoted 7 lines
Quoted 3 lines

That assumption would be correct, and I just verified it is working as expected.

Thanks. I updated the commit message to reflect this feedback. Can I add your ack to?

Yes.

Quoted 28 lines

From 682b446b1ee30e6b26b7138805bdd0ca89d1942d Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Thu, 7 May 2015 16:37:18 +0100
Subject: [PATCH] Toolstack::libvirt: Support for ACPI fallback for shutdown

This is the libvirt counterpart to "Toolstack::xl: Support for ACPI fallback for shutdown". Currently there are no jobs which test HVM guests with libvirt and so this is completely untested in the context of osstest (but at least should be harmless to current jobs).

This relies on an assumption that "virsh shutdown" behaves the same as "virsh reboot" and accepts a comma separated list of methods to try given to the --mode argument, which Jim has tested and confirmed to be true.

---
 Osstest/Toolstack/libvirt.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Osstest/Toolstack/libvirt.pm +0 -0
index 8bd7f4f..e7f4860 100644
@@ -60,7 +60,11 @@ sub shutdown_wait ($$$) {
     my ($self,$gho,$timeout) = @_;
     my $ho = $self->{Host};

Osstest/Toolstack/libvirt.pm sub shutdown_wait ($$$) { · line 70

Quoted 10 lines
Osstest/Toolstack/libvirt.pm +5 -1
     my $gn = $gho->{Name};
-    target_cmd_root($ho, "virsh shutdown $gn", 30);
+    my $mode = "paravirt";
+    $mode .= ",acpi"
+	if guest_var($gho,'acpi_shutdown','false') eq 'true';
+
+    target_cmd_root($ho, "virsh shutdown --mode $mode $gn", 30);
     guest_await_destroy($gho,$timeout);
 }
 

Acked by: Jim Fehlig <[email protected]>

Regards,
Jim

Acked-by on v1 1/1
#9 lore raw
In reply to Ian Campbell

Ian Campbell writes ("[PATCH OSSTEST] Toolstack::xl: Support for ACPI fallback for shutdown"):

Quoted 11 lines

HVM guests which do not include PV drivers will not shutdown after a simple "xl shutdown". Add a runvar to indicate that the guest will shutdown in response to an ACPI power event and apply this to the win7 and winxp test jobs.

Tested with:

    test-amd64-amd64-xl-qemuu-winxpsp3
    test-amd64-amd64-xl-qemuu-win7-amd64
    test-amd64-amd64-xl-qemuu-debianhvm-amd64
    test-amd64-amd64-xl
Quoted 7 lines

The first two correctly used the extra flag and the domains shutdown, the other two correctly didn't use the extra flag and still shutdown.

Not currently implemented for libvirt, since we currently have no libvirt tests I could try it with.