Commit cff79c96 authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

plugin_vm: Correctly identify crosvm processes as Plugin VM

The path for vm disks recently changed so we need to correspondingly
update the code here.

This is a follow-up to http://crrev.com/c/2362163 which fixed detection
of crosvm processes for Crostini. A tast test will be added in
http://crrev.com/i/3186385 once this has uprevved.

Bug: chromium:1114826
Change-Id: I97a7fb93fa18f54121ab9ca384281181b7ea0f52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364148Reviewed-by: default avatarDavid Munro <davidmunro@google.com>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799882}
parent b0c13ff1
......@@ -104,14 +104,14 @@ bool CrostiniExtractVmNameAndOwnerId(const std::string& arg,
}
// We are looking for an argument like this:
// /home/root/<cryptohome id>/pvm/UHZtRGVmYXVsdA==.pvm:/pvm:true
// /run/daemon-store/pvm/<cryptohome id>/UHZtRGVmYXVsdA==.pvm:/pvm:true
bool PluginVmExtractVmNameAndOwnerId(const std::string& arg,
std::string* vm_name_out,
std::string* owner_id_out) {
DCHECK(vm_name_out);
DCHECK(owner_id_out);
constexpr char kArgStart[] = "/home/root/";
constexpr char kArgStart[] = "/run/daemon-store/pvm/";
constexpr char kArgEnd[] = ":/pvm:true";
// Skip paths that don't start/end with the expected prefix/suffix.
......@@ -126,7 +126,7 @@ bool PluginVmExtractVmNameAndOwnerId(const std::string& arg,
std::vector<std::string> components;
vm_disk_path.GetComponents(&components);
// Expect /, home, root, <owner_id>, pvm, vm_name.pvm
// Expect /, run, daemon-store, pvm, <owner_id>, vm_name.pvm
if (components.size() != 6)
return false;
......@@ -138,7 +138,7 @@ bool PluginVmExtractVmNameAndOwnerId(const std::string& arg,
// file itself without the extension.
base::Base64Decode(vm_subdir.RemoveExtension().value(), vm_name_out);
*owner_id_out = components[3];
*owner_id_out = components[4];
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment