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

More renaming #48

Merged
merged 14 commits into from
Aug 21, 2023
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 doc/.sphinx/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pytz
requests
six
snowballstemmer
Sphinx
Sphinx==7.1.2
sphinx-autobuild
sphinxcontrib-applehelp
sphinxcontrib-devhelp
Expand Down
4 changes: 2 additions & 2 deletions incusd/acme/acme.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
"github.com/lxc/incus/shared/logger"
)

// retries describes the number of retries after which LXD will give up registering a user or
// retries describes the number of retries after which Incus will give up registering a user or
// issuing a new certificate. The number 5 was chosen because Let's Encrypt has a limit of 5
// failures per account, per hostname, per hour.
const retries = 5

// ClusterCertFilename describes the filename of the new certificate which is stored in case it
// cannot be distributed in a cluster due to offline members. LXD will try to distribute this
// cannot be distributed in a cluster due to offline members. Incus will try to distribute this
// certificate at a later stage.
const ClusterCertFilename = "cluster.crt.new"

Expand Down
16 changes: 8 additions & 8 deletions incusd/acme/acme_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func Test_certificateNeedsUpdate(t *testing.T) {
{
"Certificate is valid for more than 30 days",
args{
domain: "lxd.example.net",
domain: "foo.example.net",
cert: &x509.Certificate{
DNSNames: []string{"lxd.example.net"},
DNSNames: []string{"foo.example.net"},
NotAfter: time.Now().Add(90 * 24 * time.Hour),
},
},
Expand All @@ -33,9 +33,9 @@ func Test_certificateNeedsUpdate(t *testing.T) {
{
"Certificate is valid for less than 30 days",
args{
domain: "lxd.example.net",
domain: "foo.example.net",
cert: &x509.Certificate{
DNSNames: []string{"lxd.example.net"},
DNSNames: []string{"foo.example.net"},
NotAfter: time.Now().Add(15 * 24 * time.Hour),
},
},
Expand All @@ -44,9 +44,9 @@ func Test_certificateNeedsUpdate(t *testing.T) {
{
"Domain differs from certificate and is valid for more than 30 days",
args{
domain: "lxd.example.org",
domain: "foo.example.org",
cert: &x509.Certificate{
DNSNames: []string{"lxd.example.net"},
DNSNames: []string{"foo.example.net"},
NotAfter: time.Now().Add(90 * 24 * time.Hour),
},
},
Expand All @@ -55,9 +55,9 @@ func Test_certificateNeedsUpdate(t *testing.T) {
{
"Domain differs from certificate and is valid for less than 30 days",
args{
domain: "lxd.example.org",
domain: "foo.example.org",
cert: &x509.Certificate{
DNSNames: []string{"lxd.example.net"},
DNSNames: []string{"foo.example.net"},
NotAfter: time.Now().Add(15 * 24 * time.Hour),
},
},
Expand Down
6 changes: 3 additions & 3 deletions incusd/auth/oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func (o *Verifier) Auth(ctx context.Context, w http.ResponseWriter, r *http.Requ
if auth != "" {
// When a client wants to authenticate, it needs to set the Authorization HTTP header like this:
// Authorization Bearer <access_token>
// If set correctly, LXD will attempt to verify the access token, and grant access if it's valid.
// If the verification fails, LXD will return an InvalidToken error. The client should then either use its refresh token to get a new valid access token, or log in again.
// If the Authorization header is missing, LXD returns an AuthenticationRequired error.
// If set correctly, Incus will attempt to verify the access token, and grant access if it's valid.
// If the verification fails, Incus will return an InvalidToken error. The client should then either use its refresh token to get a new valid access token, or log in again.
// If the Authorization header is missing, Incus returns an AuthenticationRequired error.
// Both returned errors contain information which are needed for the client to authenticate.
parts := strings.Split(auth, "Bearer ")
if len(parts) != 2 {
Expand Down
2 changes: 1 addition & 1 deletion incusd/cgroup/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func Init() {
cgNamespace = true
}

// Go through the list of resource controllers for LXD.
// Go through the list of resource controllers for Incus.
selfCg, err := os.Open("/proc/self/cgroup")
if err != nil {
if os.IsNotExist(err) {
Expand Down
18 changes: 9 additions & 9 deletions incusd/dnsmasq/dhcpalloc/dhcpalloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func GetIP(subnet *net.IPNet, host int64) net.IP {
return newIP
}

// Network represents a LXD network responsible for running dnsmasq.
// Network represents an Incus network responsible for running dnsmasq.
type Network interface {
Name() string
Type() string
Expand Down Expand Up @@ -179,7 +179,7 @@ func (t *Transaction) AllocateIPv6() (net.IP, error) {
// It first checks whether there is an existing allocation for the instance.
// If no previous allocation, then a free IP is picked from the ranges configured.
func (t *Transaction) getDHCPFreeIPv4(usedIPs map[[4]byte]dnsmasq.DHCPAllocation, deviceStaticFileName string, mac net.HardwareAddr) (net.IP, error) {
lxdIP, subnet, err := net.ParseCIDR(t.opts.Network.Config()["ipv4.address"])
ip, subnet, err := net.ParseCIDR(t.opts.Network.Config()["ipv4.address"])
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -217,8 +217,8 @@ func (t *Transaction) getDHCPFreeIPv4(usedIPs map[[4]byte]dnsmasq.DHCPAllocation

IP := net.IP(startBig.Bytes())

// Check IP generated is not LXD's IP.
if IP.Equal(lxdIP) {
// Check IP generated is not Incus's IP.
if IP.Equal(ip) {
startBig.Add(startBig, inc)
continue
}
Expand Down Expand Up @@ -248,7 +248,7 @@ func (t *Transaction) getDHCPFreeIPv4(usedIPs map[[4]byte]dnsmasq.DHCPAllocation
// device's MAC address. Finally if stateful custom ranges are enabled, then a free IP is picked
// from the ranges configured.
func (t *Transaction) getDHCPFreeIPv6(usedIPs map[[16]byte]dnsmasq.DHCPAllocation, deviceStaticFileName string, mac net.HardwareAddr) (net.IP, error) {
lxdIP, subnet, err := net.ParseCIDR(t.opts.Network.Config()["ipv6.address"])
ip, subnet, err := net.ParseCIDR(t.opts.Network.Config()["ipv6.address"])
if err != nil {
return nil, err
}
Expand All @@ -274,11 +274,11 @@ func (t *Transaction) getDHCPFreeIPv6(usedIPs map[[16]byte]dnsmasq.DHCPAllocatio
return nil, err
}

// Check IP is not already allocated and not the LXD IP.
// Check IP is not already allocated and not the Incus IP.
var IPKey [16]byte
copy(IPKey[:], IP.To16())
_, inUse := usedIPs[IPKey]
if !inUse && !IP.Equal(lxdIP) {
if !inUse && !IP.Equal(ip) {
return IP, nil
}
}
Expand Down Expand Up @@ -307,8 +307,8 @@ func (t *Transaction) getDHCPFreeIPv6(usedIPs map[[16]byte]dnsmasq.DHCPAllocatio

IP := net.IP(startBig.Bytes())

// Check IP generated is not LXD's IP.
if IP.Equal(lxdIP) {
// Check IP generated is not Incus's IP.
if IP.Equal(ip) {
startBig.Add(startBig, inc)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion incusd/firewall/firewall_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
drivers "github.com/lxc/incus/incusd/firewall/drivers"
)

// Firewall represents a Incus firewall.
// Firewall represents an Incus firewall.
type Firewall interface {
String() string
Compat() (bool, error)
Expand Down
6 changes: 0 additions & 6 deletions incusd/migration/migration_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ func MatchTypes(offer *MigrationHeader, fallbackType MigrationFSType, ourTypes [
offeredFeatures = offer.GetBtrfsFeaturesSlice()
} else if offerFSType == MigrationFSType_RSYNC {
offeredFeatures = offer.GetRsyncFeaturesSlice()
if !shared.StringInSlice("bidirectional", offeredFeatures) {
// If no bi-directional support, this means we are getting a response from
// an old LXD server that doesn't support bidirectional negotiation, so
// assume LXD 3.7 level. NOTE: Do NOT extend this list of arguments.
offeredFeatures = []string{"xattrs", "delete", "compress"}
}
}

// Find common features in both our type and offered type.
Expand Down
4 changes: 2 additions & 2 deletions incusd/operations/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ type Operation struct {
// OperationCreate creates a new operation and returns it. If it cannot be
// created, it returns an error.
func OperationCreate(s *state.State, projectName string, opClass OperationClass, opType operationtype.Type, opResources map[string][]api.URL, opMetadata any, onRun func(*Operation) error, onCancel func(*Operation) error, onConnect func(*Operation, *http.Request, http.ResponseWriter) error, r *http.Request) (*Operation, error) {
// Don't allow new operations when LXD is shutting down.
// Don't allow new operations when Incus is shutting down.
if s != nil && s.ShutdownCtx.Err() == context.Canceled {
return nil, fmt.Errorf("LXD is shutting down")
return nil, fmt.Errorf("Incus is shutting down")
}

// Main attributes
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func getCPUdmi() (string, string, error) {
return "", "", fmt.Errorf("No DMI table found")
}

// GetCPU returns a filled api.ResourcesCPU struct ready for use by LXD.
// GetCPU returns a filled api.ResourcesCPU struct ready for use by Incus.
func GetCPU() (*api.ResourcesCPU, error) {
cpu := api.ResourcesCPU{}

Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func gpuAddDeviceInfo(devicePath string, nvidiaCards map[string]*api.ResourcesGP
return nil
}

// GetGPU returns a filled api.ResourcesGPU struct ready for use by LXD.
// GetGPU returns a filled api.ResourcesGPU struct ready for use by Incus.
func GetGPU() (*api.ResourcesGPU, error) {
gpu := api.ResourcesGPU{}
gpu.Cards = []api.ResourcesGPUCard{}
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func getTotalMemory(sysDevicesBase string) uint64 {
return blockSize * count
}

// GetMemory returns a filled api.ResourcesMemory struct ready for use by LXD.
// GetMemory returns a filled api.ResourcesMemory struct ready for use by Incus.
func GetMemory() (*api.ResourcesMemory, error) {
memory := api.ResourcesMemory{}

Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func networkAddDeviceInfo(devicePath string, pciDB *pcidb.PCIDB, uname unix.Utsn
return nil
}

// GetNetwork returns a filled api.ResourcesNetwork struct ready for use by LXD.
// GetNetwork returns a filled api.ResourcesNetwork struct ready for use by Incus.
func GetNetwork() (*api.ResourcesNetwork, error) {
network := api.ResourcesNetwork{}
network.Cards = []api.ResourcesNetworkCard{}
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/pci.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/lxc/incus/shared/api"
)

// GetPCI returns a filled api.ResourcesPCI struct ready for use by LXD.
// GetPCI returns a filled api.ResourcesPCI struct ready for use by Incus.
func GetPCI() (*api.ResourcesPCI, error) {
pci := api.ResourcesPCI{}
pci.Devices = []api.ResourcesPCIDevice{}
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/lxc/incus/shared/api"
)

// GetResources returns a filled api.Resources struct ready for use by LXD.
// GetResources returns a filled api.Resources struct ready for use by Incus.
func GetResources() (*api.Resources, error) {
// Get CPU information
cpu, err := GetCPU()
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func storageAddDriveInfo(devicePath string, disk *api.ResourcesStorageDisk) erro
return nil
}

// GetStorage returns a filled api.ResourcesStorage struct ready for use by LXD.
// GetStorage returns a filled api.ResourcesStorage struct ready for use by Incus.
func GetStorage() (*api.ResourcesStorage, error) {
storage := api.ResourcesStorage{}
storage.Disks = []api.ResourcesStorageDisk{}
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
var sysClassDMIID = "/sys/class/dmi/id"
var systemType string

// GetSystem returns a filled api.ResourcesSystem struct ready for use by LXD.
// GetSystem returns a filled api.ResourcesSystem struct ready for use by Incus.
func GetSystem() (*api.ResourcesSystem, error) {
var err error
system := api.ResourcesSystem{}
Expand Down
2 changes: 1 addition & 1 deletion incusd/resources/usb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var sysBusUSB = "/sys/bus/usb/devices"

// GetUSB returns a filled api.ResourcesUSB struct ready for use by LXD.
// GetUSB returns a filled api.ResourcesUSB struct ready for use by Incus.
func GetUSB() (*api.ResourcesUSB, error) {
// Load the USB database.
usbid.Load()
Expand Down
4 changes: 2 additions & 2 deletions incusd/rsync/rsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func sendSetup(name string, path string, bwlimit string, execPath string, featur
* stdin/stdout, but that also seemed messy. In any case, this seems to
* work just fine.
*/
auds := fmt.Sprintf("@lxd/%s", uuid.New())
auds := fmt.Sprintf("@incusd/%s", uuid.New())
// We simply copy a part of the uuid if it's longer than the allowed
// maximum. That should be safe enough for our purposes.
if len(auds) > linux.ABSTRACT_UNIX_SOCK_LEN-1 {
Expand All @@ -152,7 +152,7 @@ func sendSetup(name string, path string, bwlimit string, execPath string, featur
/*
* Here, the path /tmp/foo is ignored. Since we specify localhost,
* rsync thinks we are syncing to a remote host (in this case, the
* other end of the lxd websocket), and so the path specified on the
* other end of the incus websocket), and so the path specified on the
* --server instance of rsync takes precedence.
*/
rsyncCmd := fmt.Sprintf("%s netcat %s %s --", execPath, auds, name)
Expand Down
Loading
Loading