-
Notifications
You must be signed in to change notification settings - Fork 40
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
[sled-agent] Use zone-network-setup service after underlay is up #7260
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -165,6 +165,38 @@ impl<'t> SmfHelper<'t> { | |
Ok(()) | ||
} | ||
|
||
pub fn delpropvalue<P, V>(&self, prop: P, val: V) -> Result<(), Error> | ||
where | ||
P: ToString, | ||
V: ToString, | ||
{ | ||
match self | ||
.running_zone | ||
.run_cmd(&[ | ||
SVCCFG, | ||
"-s", | ||
&self.smf_name, | ||
"delpropvalue", | ||
&prop.to_string(), | ||
&val.to_string(), | ||
]) | ||
.map_err(|err| Error::ZoneCommand { | ||
intent: format!("del {} smf property value", prop.to_string()), | ||
err, | ||
}) { | ||
Ok(_) => (), | ||
Err(e) => { | ||
// If a property already doesn't exist we don't need to | ||
// return an error | ||
if !e.to_string().contains("No such property") { | ||
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. We'd hit this if one tried to delete a property that doesn't exist, right? As opposed to deleting a value that doesn't exist from a property that does. Is that what we want? I could see an argument for failing if we try to deleting a non-existent property. 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. Hm, yeah I see your point. In this case, after deleting we run the That said, returning the error like you propose, would guarantee that we are not adding a property where it's not meant to be. I'm a little torn on this one. WDYT? |
||
return Err(e); | ||
} | ||
} | ||
}; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn delpropvalue_default_instance<P, V>( | ||
&self, | ||
prop: P, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
<service_fmri value='svc:/milestone/network:default' /> | ||
</dependency> | ||
|
||
<!-- Run after the NDP daemon is online.. --> | ||
<!-- Run after the NDP daemon is online. --> | ||
<dependency name='ndp' grouping='require_all' restart_on='none' | ||
type='service'> | ||
<service_fmri value='svc:/network/routing/ndp:default' /> | ||
|
@@ -31,6 +31,10 @@ | |
timeout_seconds='0' /> | ||
|
||
<exec_method type='method' name='stop' exec=':true' timeout_seconds='0' /> | ||
<!-- We use the same command as the start method as it is safe to rerun. --> | ||
<exec_method type='method' name='refresh' | ||
exec='/opt/oxide/zone-setup-cli/bin/zone-setup common-networking -d %{config/datalink} -s %{config/static_addr} -g %{config/gateway}' | ||
timeout_seconds='0' /> | ||
Comment on lines
+34
to
+37
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. What happens if the service is currently running when it's refreshed? 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. Nothing really. All of the commands on that service are idempotent (I also manually refreshed this service multiple times to see what happened). Additionally, it's highly unlikely this would happen. Several other services on the switch zone depend on this service, which means we wouldn't even get to the point where the service is refreshed, if the zone-network-setup service hadn't exited with 0 (as far as I understand how the switch zone startup works, I could be wrong though). |
||
|
||
<property_group name='startd' type='framework'> | ||
<propval name='duration' type='astring' value='transient' /> | ||
|
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.
How does this differ from the existing
delpropvalue_default_instance
method below? There's only one (default) instance of this service in a zone AFAIU, so they seem like they should be equivalent. I could be missing something.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.
They're almost the same, yes. You can set properties on the instance itself and/or on the service.
Example:
The zone-network-service has it's properties set on the service directly so the other command would not delete the correct property values