Skip to content
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

Match correct value for support_suspend #254

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ requirements:
Share filesystem of host to the guest system.
requirements:
- path: The path to share.
- support_suspend: enable suspend for guest.
- support_suspend: set the value to `true` or `enable` to enable suspend for guest.
- audio_type: must be one of these two options:
- sof-hda: enable "sof-hda" only when "sof-hda" sound card is enabled in the host and you are making audio passthrough for guest.
- legacy-hda: In all other cases use "legacy-hda" only.
Expand Down
19 changes: 14 additions & 5 deletions src/guest/vm_builder_qemu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -640,21 +640,29 @@ void VmBuilderQemu::InitAafCfg(void){
}
}

void VmBuilderQemu::BuildAafCfg(void) {
bool VmBuilderQemu::BuildAafCfg(void) {
std::string aaf_path = cfg_.GetValue(kGroupAaf, kAafPath);
if (!aaf_path.empty()) {
emul_cmd_.append(" -virtfs local,mount_tag=aaf,security_model=none,path=" + aaf_path);

std::string aaf_suspend = cfg_.GetValue(kGroupAaf, kAafSuspend);
if (!aaf_suspend.empty()) {
aaf_cfg_->Set(kAafKeySuspend, aaf_suspend);
if (aaf_suspend.compare("true") == 0 || aaf_suspend.compare("enable") == 0) {
aaf_cfg_->Set(kAafKeySuspend, "true");
} else if (aaf_suspend.compare("false") == 0 || aaf_suspend.compare("disable") == 0) {
aaf_cfg_->Set(kAafKeySuspend, "false");
} else {
LOG(error) << "Invalid value of 'support_suspend'";
return false;
}
}

std::string aaf_audio_type = cfg_.GetValue(kGroupAaf, kAafAudioType);
if (!aaf_audio_type.empty()) {
aaf_cfg_->Set(kAafKeyAudioType, aaf_audio_type);
}

emul_cmd_.append(" -virtfs local,mount_tag=aaf,security_model=none,path=" + aaf_path);
}
return true;
}

bool VmBuilderQemu::BuildVgpuCmd(void) {
Expand Down Expand Up @@ -804,7 +812,8 @@ bool VmBuilderQemu::BuildVmArgs(void) {

BuildVinputCmd();

BuildAafCfg();
if (!BuildAafCfg())
return false;

BuildNetCmd();

Expand Down
2 changes: 1 addition & 1 deletion src/guest/vm_builder_qemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class VmBuilderQemu : public VmBuilder {
void BuildRpmbCmd(void);
void BuildVtpmCmd(void);
void InitAafCfg(void);
void BuildAafCfg(void);
bool BuildAafCfg(void);
bool BuildVgpuCmd(void);
void BuildVinputCmd(void);
void BuildDispCmd(void);
Expand Down