-
Notifications
You must be signed in to change notification settings - Fork 42
forget less NVMe state across migration #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
9b10a83
67c2524
64f769e
72bcc9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -318,14 +318,22 @@ async fn multiple_migrations(ctx: &TestCtx) { | |
| ); | ||
| } | ||
|
|
||
| #[phd_testcase] | ||
| async fn migration_smoke_test(ctx: &TestCtx) { | ||
| let vm = ctx.spawn_default_vm("migration_smoke_test_0").await?; | ||
| run_smoke_test(ctx, vm).await?; | ||
| } | ||
|
|
||
| async fn run_smoke_test(ctx: &TestCtx, mut source: TestVm) -> Result<()> { | ||
| source.launch().await?; | ||
| source.wait_to_boot().await?; | ||
| let lsout = | ||
| source.run_shell_command("ls foo.bar 2> /dev/null").check_err().await?; | ||
| assert_eq!(lsout, ""); | ||
|
|
||
| // create an empty file on the source VM. | ||
| // create an empty file on the source VM. `/` might be a tmpfs, and the | ||
| // guest may have no writable filesystem even. validation post-migration is | ||
| // a bit tricky, below. | ||
| source.run_shell_command("touch ./foo.bar").await?; | ||
| source.run_shell_command("sync ./foo.bar").await?; | ||
|
|
||
|
|
@@ -334,13 +342,72 @@ async fn run_smoke_test(ctx: &TestCtx, mut source: TestVm) -> Result<()> { | |
| &[Action::MigrateToPropolis(artifacts::DEFAULT_PROPOLIS_ARTIFACT)], | ||
| |target: &TestVm| { | ||
| Box::pin(async { | ||
| // forget about any pagecache data, dentries, inodes; we want to | ||
| // read these from the real backing storage, because we want to | ||
| // make sure it still works! | ||
| target | ||
| .run_shell_command("echo 3 > /proc/sys/vm/drop_caches") | ||
| .await | ||
| .expect("can drop caches"); | ||
|
|
||
| // the file should still exist on the target VM after migration. | ||
| let lsout = target | ||
| .run_shell_command("ls foo.bar") | ||
| .ignore_status() | ||
| .await | ||
| .expect("can try to run `ls foo.bar`"); | ||
| assert_eq!(lsout, "foo.bar"); | ||
|
|
||
| // we have a small conundrum: it's possible that the home | ||
| // directory we wrote into is a tmpfs anyway. so by succeeding | ||
| // this much, we may have really just tested memory is intact. | ||
|
Comment on lines
+361
to
+363
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hawkw i would like for you to look at this change just because i can imagine the eye roll and swear when you read this comment thanks in advance. it's so much more annoying than i thought it was.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙄🤬 |
||
| // | ||
| // ensure we test *some* device emulation by at least trying to | ||
| // `ls` the thing we booted out. it *should* be a disk, so we'll | ||
| // exercise some device emulation machinery.. unfortunately | ||
| // finding a productive place to `ls` is a bit ridiculous: | ||
|
|
||
| let mount_grep = target | ||
| .run_shell_command("mount | grep ' / type tmpfs '") | ||
| .ignore_status() | ||
| .await | ||
| .expect("can check mounted filesystems and grep"); | ||
|
|
||
| let root_is_tmpfs = !mount_grep.is_empty(); | ||
|
|
||
| if root_is_tmpfs { | ||
| // the guest is *probably* an Alpine. `/` is a figment of | ||
| // its imagination; a tmpfs with the actual disk somewhere | ||
| // under /media, like /media/nvme0n1. try looking there, and | ||
| // if that fails we'll need to improve the test, phd, or | ||
| // both. | ||
|
Comment on lines
+379
to
+383
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lmao this rocks alpine is such a distro |
||
| target | ||
| .run_shell_command("ls /media/nvme0n1/boot") | ||
| .await | ||
| .expect("can ls the boot data"); | ||
| } else { | ||
| // the guest probably has a read-write root. the above, it | ||
| // turns out, probably also exercised the disk. check /boot | ||
| // anyway for good measure. | ||
| target | ||
| .run_shell_command("ls /boot") | ||
| .await | ||
| .expect("can ls the boot data"); | ||
| } | ||
|
|
||
| // the `ls` succeeded ... eventually. it's possible the disk | ||
| // *was* broken, the guest realized this, reset the disk, and | ||
| // that brought it back. if so, there's a line about resetting | ||
| // the controller in dmesg. so if we see that, we've actually | ||
| // failed to migrate reasonably. | ||
| let disk_reset = target | ||
| .run_shell_command("dmesg | grep 'reset controller'") | ||
| .await | ||
| .expect("can grep dmesg"); | ||
|
|
||
| if !disk_reset.is_empty() { | ||
| panic!("controller reset during the test?! {}", disk_reset); | ||
| } | ||
| }) | ||
| }, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmmmmaybe worth explicitly calling out that this is inside the lock?