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

fix: Support creating file with open_file_nonblock #4028

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ sudo iptables -I FORWARD 1 -i tap0 -o eth0 -j ACCEPT
API_SOCKET="/tmp/firecracker.socket"
LOGFILE="./firecracker.log"

# Create log file
touch $LOGFILE

# Set log file
curl -X PUT --unix-socket "${API_SOCKET}" \
--data "{
Expand Down
9 changes: 0 additions & 9 deletions src/vmm/src/vmm_config/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,6 @@ mod tests {
fn test_init_logger() {
let default_instance_info = InstanceInfo::default();

// Error case: initializing logger with invalid pipe returns error.
let desc = LoggerConfig {
log_path: PathBuf::from("not_found_file_log"),
level: LoggerLevel::Debug,
show_level: false,
show_log_origin: false,
};
assert!(init_logger(desc, &default_instance_info).is_err());

// Initializing logger with valid pipe is ok.
let log_file = TempFile::new().unwrap();
let desc = LoggerConfig {
Expand Down
6 changes: 0 additions & 6 deletions src/vmm/src/vmm_config/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ mod tests {

#[test]
fn test_init_metrics() {
// Error case: initializing metrics with invalid pipe returns error.
let desc = MetricsConfig {
metrics_path: PathBuf::from("not_found_file_metrics"),
};
assert!(init_metrics(desc).is_err());

// Initializing metrics with valid pipe is ok.
let metrics_file = TempFile::new().unwrap();
let desc = MetricsConfig {
Expand Down
1 change: 1 addition & 0 deletions src/vmm/src/vmm_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ impl RateLimiterConfig {
fn open_file_nonblock(path: &Path) -> Result<File, std::io::Error> {
OpenOptions::new()
.custom_flags(O_NONBLOCK)
.create(true)
.read(true)
.write(true)
.open(path)
Expand Down
20 changes: 0 additions & 20 deletions tests/integration_tests/functional/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,6 @@ def test_error_logs(test_microvm_with_api):
_test_log_config(microvm=test_microvm_with_api, log_level="Error")


def test_log_config_failure(test_microvm_with_api):
"""
Check passing invalid FIFOs is detected and reported as an error.
"""
microvm = test_microvm_with_api
microvm.spawn(create_logger=False)
microvm.basic_config()

response = microvm.logger.put(
log_path="invalid log fifo",
level="Info",
show_level=True,
show_log_origin=True,
)
# only works if log level is Debug
microvm.time_api_requests = False
assert microvm.api_session.is_status_bad_request(response.status_code)
assert response.json()["fault_message"]


def test_api_requests_logs(test_microvm_with_api):
"""
Test that API requests are logged.
Expand Down