lxd icon indicating copy to clipboard operation
lxd copied to clipboard

Add required=false option for nic devices with an unavailable parent

Open m-ueberall opened this issue 2 years ago • 5 comments

Required information

  • Distribution: Ubuntu
  • Distribution version: 20.04 ("Focal Fossa")
  • Kernel version: 5.15.x (x86_64, aarch64)
  • LXC, LXD version: 5.3

Issue description

If a container uses a network which is unavailable, it cannot be started (even if additional, available networks exist). It would be helpful to be able to mark certain networks (network types?) – in my case: an OVN network – as required: "false" like with devices/disk paths so that it's not necessary to modify the container's configuration in order to bring it up after, e.g., rebooting the host machine. (Note that running containers are "unaffected" if the network becomes unavailable.)

Steps to reproduce

  1. Ensure that a certain network used by one or more containers is available
  2. Start all containers
  3. Bring down the network in question (while all containers from the previous step are still up)
  4. Stop and try to restart one of the above containers; the last step will now fail: Error: Failed pre-start check for device "eth0": Network "ovn01" unavailable on this server

m-ueberall avatar Jul 12 '22 09:07 m-ueberall

If no one else has taken this issue, I would like to try to tackle it. It would help me considerably if you could show me where are the related files and any tips.

SooryR avatar Aug 07 '22 14:08 SooryR

Thanks assigned to you.

tomponline avatar Aug 09 '22 08:08 tomponline

If you look for the PreStartCheck() functions in the code base, you'll see some of the NICs have this bit:

	// If managed network is not available, don't try and start instance.
	if d.network.LocalStatus() == api.StoragePoolStatusUnvailable {
		return api.StatusErrorf(http.StatusServiceUnavailable, "Network %q unavailable on this server", d.network.Name())
	}

You'll need to introduce a NIC device setting called required (similar to the disk one here https://linuxcontainers.org/lxd/docs/master/instances/#type-disk) that defaults to true if not specified. If set to false then you can skip the check in PreStartCheck() and then in Start() if the network isn't available just return nil.

tomponline avatar Aug 09 '22 08:08 tomponline

@bakhtiar56 perhaps you would like to look at this one as it looks like @SooryR has not been available to do it.

tomponline avatar Sep 28 '22 10:09 tomponline

sure, I would love to tackle it.

bakhtiar56 avatar Sep 28 '22 12:09 bakhtiar56

Hi! Is this issue still open to be worked on? My partner and I are students from UT Austin, and we were wondering if we could tackle this as a good first issue for our virtualization class?

jxie0615 avatar Feb 17 '23 18:02 jxie0615

@bakhtiar56 are you ok for @jxie0615 to take this one?

tomponline avatar Feb 17 '23 18:02 tomponline

sure

​Sincerely Bakhtiar Rasheed


From: Tom Parrott @.> Sent: Friday, February 17, 2023 11:42:36 PM To: lxc/lxd @.> Cc: Bakhtiar Rasheed @.>; Mention @.> Subject: Re: [lxc/lxd] Add required=false option for nic devices with an unavailable parent (Issue #10660)

@bakhtiar56https://github.com/bakhtiar56 are you ok for @jxie0615https://github.com/jxie0615 to take this one?

— Reply to this email directly, view it on GitHubhttps://github.com/lxc/lxd/issues/10660#issuecomment-1435087411, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATLWB7Y6TXPR4D4KRADBPD3WX7BBZANCNFSM53KKIZAA. You are receiving this because you were mentioned.Message ID: @.***>

bakhtiar56 avatar Feb 18 '23 03:02 bakhtiar56

Hi,

Forgive me for not having extensive knowledge on lxc, but is there a way to easily bring down a network made by lxc?

jeffreyxie0615 avatar Mar 25 '23 00:03 jeffreyxie0615

@jeffreyxie0615 which network/nic type are you working on first? ovn?

tomponline avatar Apr 13 '23 14:04 tomponline

Yes! I'm currently working on ovn.

jeffreyxie0615 avatar Apr 19 '23 06:04 jeffreyxie0615

Cleared assignment due to inactivity

stgraber avatar Jun 11 '23 03:06 stgraber