id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c176800 | != name {
pcs = pcs[:len(pcs)-1]
}
return pcs
} | |
c176801 |
pcs = pcs[:len(pcs)-1]
}
return pcs
} | |
c176802 |
valueStr, ok := xattrs["security.capability"]
if !ok {
return nil, nil
}
return []byte(valueStr), nil
} | |
c176803 | C.ssize_t(len(caps)), C.uint32_t(uid))
if r != 0 {
return fmt.Errorf("Failed to apply capabilities to: %s", path)
}
return nil
} | |
c176804 | if pt.Tracker != nil {
pt.Tracker.total += int64(n)
pt.Tracker.update(n)
}
return n, err
} | |
c176805 | C.CString(devPath)
defer C.free(unsafe.Pointer(cDevPath))
return C.quota_supported(cDevPath) == 0, nil
} | |
c176806 | 0 {
return 0, fmt.Errorf("Failed to get project from '%s'", path)
}
return uint32(id), nil
} | |
c176807 | return fmt.Errorf("Failed to set project id '%d' on '%s'", id, path)
}
return nil
} | |
c176808 | quota on the project
err = SetProjectQuota(path, id, 0)
if err != nil {
return err
}
return nil
} | |
c176809 |
cDevPath := C.CString(devPath)
defer C.free(unsafe.Pointer(cDevPath))
size := C.quota_get_usage(cDevPath, C.uint32_t(id))
if size < 0 {
return -1, fmt.Errorf("Failed to get project consumption for id '%d' on '%s'", id, path)
}
return int64(size), nil
} | |
c176810 |
if C.quota_set(cDevPath, C.uint32_t(id), C.int(bytes/1024)) != 0 {
return fmt.Errorf("Failed to set project quota for id '%d' on '%s'", id, path)
}
return nil
} | |
c176811 | s,
container: c,
id: args.ID,
name: name,
creationDate: args.CreationDate,
expiryDate: args.ExpiryDate,
containerOnly: args.ContainerOnly,
optimizedStorage: args.OptimizedStorage,
}, nil
} | |
c176812 |
// Now create the empty snapshot
err = sourceContainer.Storage().ContainerBackupCreate(*b, sourceContainer)
if err != nil {
s.Cluster.ContainerBackupRemove(args.Name)
return errors.Wrap(err, "Backup storage")
}
return nil
} | |
c176813 | return err
}
// Check if we can remove the container directory
empty, _ := shared.PathIsEmpty(backupsPath)
if empty {
err := os.Remove(backupsPath)
if err != nil {
return err
}
}
// Rename the database record
err = b.state.Cluster.ContainerBackupRename(b.name, newName)
if err != nil {
return err
}
return nil
} | |
c176814 | doBackupDelete(b.state, b.name, b.container.Name())
} | |
c176815 | rootDiskDeviceFound = true
}
}
if !rootDiskDeviceFound {
return fmt.Errorf("No root device could be found")
}
file, err := os.Create(path)
if err != nil {
return err
}
defer file.Close()
data, err := yaml.Marshal(&backup)
if err != nil {
return err
}
_, err = file.Write(data)
if err != nil {
return err
}
return nil
}
err = f(shared.VarPath("storage-pools", pool.Name, "containers", b.Name, "backup.yaml"))
if err != nil {
return err
}
for _, snap := range b.Snapshots {
err = f(shared.VarPath("storage-pools", pool.Name, "containers-snapshots", b.Name, snap,
"backup.yaml"))
if err != nil {
return err
}
}
return nil
} | |
c176816 |
err = rows.Scan(&count)
if err != nil {
return -1, fmt.Errorf("failed to scan count column")
}
if rows.Next() {
return -1, fmt.Errorf("more than one row returned")
}
err = rows.Err()
if err != nil {
return -1, err
}
return count, nil
} | |
c176817 | tables {
count, err := Count(tx, table, "")
if err != nil {
return nil, errors.Wrapf(err, "Failed to count rows of %s", table)
}
counts[table] = count
}
return counts, nil
} | |
c176818 | tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
},
PreferServerCipherSuites: true,
}
} | |
c176819 | source as well.
if LVFilesystem == "btrfs" {
ourUmount, err := s.ContainerUmount(source, source.Path())
if err != nil {
return err
}
if ourUmount {
defer s.ContainerMount(source)
}
}
msg, err := fsGenerateNewUUID(LVFilesystem, containerLvDevPath)
if err != nil {
logger.Errorf("Failed to create new \"%s\" UUID for container \"%s\" on storage pool \"%s\": %s", LVFilesystem, containerName, s.pool.Name, msg)
return err
}
return nil
} | |
c176820 |
}
defer source.Unfreeze()
}
bwlimit := s.pool.Config["rsync.bwlimit"]
output, err := rsyncLocalCopy(sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
if err != nil {
return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
}
if readonly {
targetLvmName := containerNameToLVName(targetName)
poolName := s.getOnDiskPoolName()
output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeAPIEndpointContainers, targetLvmName))
if err != nil {
logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s", targetName, output)
return err
}
}
return nil
} | |
c176821 | // If the storage pool uses a thinpool we can have snapshots of
// snapshots.
err = s.copyContainerThinpool(target, source, false)
} else {
// If the storage pools does not use a thinpool we need to
// perform full copies.
err = s.copyContainerLv(target, source, false, refresh)
}
if err != nil {
return err
}
err = target.TemplateApply("copy")
if err != nil {
return err
}
return nil
} | |
c176822 | sourcePool == s.pool.Name {
err = s.copyVolumeThinpool(source, s.volume.Name, false)
} else {
err = s.copyVolumeLv(sourcePool, source, s.volume.Name, false)
}
if err != nil {
return err
}
return nil
} | |
c176823 | (*api.Image, string, error) {
return nil, "", fmt.Errorf("Private images aren't supported by the simplestreams protocol")
} | |
c176824 | return nil, fmt.Errorf("Private images aren't supported by the simplestreams protocol")
} | |
c176825 | extract just the names
names := []string{}
for _, alias := range aliases {
names = append(names, alias.Name)
}
return names, nil
} | |
c176826 | err != nil {
return err
}
err = proto.Unmarshal(buf, msg)
if err != nil {
return err
}
return nil
} | |
c176827 | err != nil {
return err
}
err = shared.WriteAll(w, data)
if err != nil {
return err
}
return nil
} | |
c176828 |
Success: proto.Bool(err == nil),
Message: proto.String(message),
}
ProtoSend(ws, &msg)
} | |
c176829 |
select {
case er.consoleDisconnect <- true:
return 0, err
default:
return 0, err
}
}
*er.foundEscape = false
return n, err
} | |
c176830 |
timeout := time.After(30 * time.Second)
done := make(chan struct{})
var containers []api.Container
var err error
go func() {
containers, err = f()
done <- struct{}{}
}()
select {
case <-timeout:
err = fmt.Errorf("Timeout getting containers from node %s", node)
case <-done:
}
return containers, err
} | |
c176831 | logger.Debugf("Retry failed db interaction (%v)", err)
time.Sleep(250 * time.Millisecond)
continue
}
}
break
}
return err
} | |
c176832 | return true
}
// Despite the description this is usually a lost leadership error.
if strings.Contains(err.Error(), "disk I/O error") {
return true
}
return false
} | |
c176833 | strings.TrimSpace(string(contents))
}
return ""
} | |
c176834 | := os.MkdirAll(customSubvolumePath, 0700)
if err != nil {
return err
}
}
// Create subvolume.
var customSubvolumeName string
if isSnapshot {
customSubvolumeName = getStoragePoolVolumeSnapshotMountPoint(s.pool.Name, s.volume.Name)
} else {
customSubvolumeName = getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
}
err = btrfsSubVolumeCreate(customSubvolumeName)
if err != nil {
return err
}
// apply quota
if s.volume.Config["size"] != "" {
size, err := shared.ParseByteSizeString(s.volume.Config["size"])
if err != nil {
return err
}
err = s.StorageEntitySetQuota(storagePoolVolumeTypeCustom, size, nil)
if err != nil {
return err
}
}
logger.Infof("Created BTRFS storage volume \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
return nil
} | |
c176835 | s.pool.Name, container.Name())
return isBtrfsSubVolume(containerMntPoint)
} | |
c176836 | lxdStorageOngoingOperationMap[imageStoragePoolLockID]; ok {
lxdStorageMapLock.Unlock()
if _, ok := <-waitChannel; ok {
logger.Warnf("Received value over semaphore, this should not have happened")
}
} else {
lxdStorageOngoingOperationMap[imageStoragePoolLockID] = make(chan bool)
lxdStorageMapLock.Unlock()
var imgerr error
if !shared.PathExists(imageMntPoint) || !isBtrfsSubVolume(imageMntPoint) {
imgerr = s.ImageCreate(fingerprint, tracker)
}
lxdStorageMapLock.Lock()
if waitChannel, ok := lxdStorageOngoingOperationMap[imageStoragePoolLockID]; ok {
close(waitChannel)
delete(lxdStorageOngoingOperationMap, imageStoragePoolLockID)
}
lxdStorageMapLock.Unlock()
if imgerr != nil {
return errors.Wrap(imgerr, "Failed to create image volume")
}
}
// Create a rw snapshot at
// ${LXD_DIR}/storage-pools/<pool>/containers/<name>
// from the mounted ro image snapshot mounted at
// ${LXD_DIR}/storage-pools/<pool>/images/<fingerprint>
containerSubvolumeName := getContainerMountPoint(container.Project(), s.pool.Name, container.Name())
err = s.btrfsPoolVolumesSnapshot(imageMntPoint, containerSubvolumeName, false, false)
if err != nil {
return errors.Wrap(err, "Failed to storage pool volume snapshot")
}
// Create the mountpoint for the container at:
// ${LXD_DIR}/containers/<name>
err = createContainerMountpoint(containerSubvolumeName, container.Path(), container.IsPrivileged())
if err != nil {
return errors.Wrap(err, "Failed to create container mountpoint")
}
logger.Debugf("Created BTRFS storage volume for container \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
err = container.TemplateApply("create")
if err != nil {
return errors.Wrap(err, "Failed to apply container template")
}
return nil
} | |
c176837 | s.pool.Name, snapshotContainer.Name())
newSnapshotSubvolumeName := getSnapshotMountPoint(snapshotContainer.Project(), s.pool.Name, newName)
err = os.Rename(oldSnapshotSubvolumeName, newSnapshotSubvolumeName)
if err != nil {
return err
}
logger.Debugf("Renamed BTRFS storage volume for snapshot \"%s\" from %s to %s", s.volume.Name, s.volume.Name, newName)
return nil
} | |
c176838 | err != nil {
return err
}
snapshotMntPointSymlinkTarget := shared.VarPath("storage-pools", s.pool.Name, "containers-snapshots", projectPrefix(snapshotContainer.Project(), sourceName))
snapshotMntPointSymlink := shared.VarPath("snapshots", projectPrefix(snapshotContainer.Project(), sourceName))
if !shared.PathExists(snapshotMntPointSymlink) {
err := createContainerMountpoint(snapshotMntPointSymlinkTarget, snapshotMntPointSymlink, snapshotContainer.IsPrivileged())
if err != nil {
return err
}
}
logger.Debugf("Created empty BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\"", s.volume.Name, s.pool.Name)
return nil
} | |
c176839 | err != nil {
return err
}
}
// Delete the subvol itself
err = btrfsSubVolumeDelete(subvol)
if err != nil {
return err
}
return nil
} | |
c176840 | BTRFS_FIRST_FREE_OBJECTID
if fs.Ino != 256 {
return false
}
return true
} | |
c176841 | value string
err := rows.Scan(&key, &value)
if err != nil {
return nil, err
}
values[key] = value
}
err = rows.Err()
if err != nil {
return nil, err
}
return values, nil
} | |
c176842 | continue
}
changes[key] = value
}
err := upsertConfig(tx, table, changes)
if err != nil {
return errors.Wrap(err, "updating values failed")
}
err = deleteConfig(tx, table, deletes)
if err != nil {
return errors.Wrap(err, "deleting values failed")
}
return nil
} | |
c176843 | Params(n))
values := make([]interface{}, n)
for i, key := range keys {
values[i] = key
}
_, err := tx.Exec(query, values...)
return err
} | |
c176844 | {
// Section separator (when rendering a full section
out += "\n"
} else {
// Remove last newline when rendering partial section
out = strings.TrimSuffix(out, "\n")
}
return out
} | |
c176845 | _, err := r.queryStruct("GET", "/projects?recursion=1", nil, "", &projects)
if err != nil {
return nil, err
}
return projects, nil
} | |
c176846 | etag, err := r.queryStruct("GET", fmt.Sprintf("/projects/%s", url.QueryEscape(name)), nil, "", &project)
if err != nil {
return nil, "", err
}
return &project, etag, nil
} | |
c176847 | _, err := r.query("POST", "/projects", project, "")
if err != nil {
return err
}
return nil
} | |
c176848 | _, err := r.query("PUT", fmt.Sprintf("/projects/%s", url.QueryEscape(name)), project, ETag)
if err != nil {
return err
}
return nil
} | |
c176849 | err := r.queryOperation("POST", fmt.Sprintf("/projects/%s", url.QueryEscape(name)), project, "")
if err != nil {
return nil, err
}
return op, nil
} | |
c176850 | (errno == syscall.EAGAIN || errno == syscall.EINTR) {
goto again
}
return n, err
} | |
c176851 | && (errno == syscall.EAGAIN || errno == syscall.EINTR) {
goto again
}
return n, err
} | |
c176852 |
c.reqChCancel = make(map[*http.Request]chan struct{})
c.lock.Unlock()
return &c
} | |
c176853 |
c.lock.Unlock()
return length > 0
} | |
c176854 | this time")
}
c.lock.Lock()
for req, ch := range c.reqChCancel {
close(ch)
delete(c.reqChCancel, req)
}
c.lock.Unlock()
return nil
} | |
c176855 |
c.lock.Lock()
c.reqChCancel[req] = chCancel
c.lock.Unlock()
}
req.Cancel = chCancel
go func() {
<-chDone
if c != nil {
c.lock.Lock()
delete(c.reqChCancel, req)
c.lock.Unlock()
}
}()
resp, err := client.Do(req)
return resp, chDone, err
} | |
c176856 | != nil {
return SmartError(err)
}
cluster := api.Cluster{
ServerName: name,
Enabled: name != "",
MemberConfig: memberConfig,
}
return SyncResponseETag(true, cluster, cluster)
} | |
c176857 | "storage-pool",
Name: pool,
Key: key,
Description: fmt.Sprintf("\"%s\" property for storage pool \"%s\"", key, pool),
}
keys = append(keys, key)
}
}
for network, config := range networks {
for key := range config {
if strings.HasPrefix(key, "volatile.") {
continue
}
key := api.ClusterMemberConfigKey{
Entity: "network",
Name: network,
Key: key,
Description: fmt.Sprintf("\"%s\" property for network \"%s\"", key, network),
}
keys = append(keys, key)
}
}
return keys, nil
} | |
c176858 | certificate"))
}
// Reset the cluster database and make it local to this node.
d.endpoints.NetworkUpdateCert(cert)
err = d.gateway.Reset(cert)
if err != nil {
return SmartError(err)
}
// Re-open the cluster database
address, err := node.HTTPSAddress(d.db)
if err != nil {
return SmartError(err)
}
store := d.gateway.ServerStore()
d.cluster, err = db.OpenCluster(
"db.bin", store, address, "/unused/db/dir",
d.config.DqliteSetupTimeout,
dqlite.WithDialFunc(d.gateway.DialFunc()),
dqlite.WithContext(d.gateway.Context()),
)
if err != nil {
return SmartError(err)
}
// Stop the clustering tasks
d.stopClusterTasks()
// Remove the cluster flag from the agent
version.UserAgentFeatures(nil)
return EmptySyncResponse
} | |
c176859 | errors.Wrap(err, "failed to connect to leader node")
}
_, _, err = client.RawQuery("POST", "/internal/cluster/rebalance", nil, "")
if err != nil {
return errors.Wrap(err, "request to rebalance cluster failed")
}
return nil
} | |
c176860 | promote itself.
post := &internalClusterPostPromoteRequest{}
for _, node := range nodes {
post.RaftNodes = append(post.RaftNodes, internalRaftNode{
ID: node.ID,
Address: node.Address,
})
}
cert := d.endpoints.NetworkCert()
client, err := cluster.Connect(address, cert, false)
if err != nil {
return SmartError(err)
}
_, _, err = client.RawQuery("POST", "/internal/cluster/promote", post, "")
if err != nil {
return SmartError(err)
}
return SyncResponse(true, nil)
} | |
c176861 | make([]db.RaftNode, len(req.RaftNodes))
for i, node := range req.RaftNodes {
nodes[i].ID = node.ID
nodes[i].Address = node.Address
}
err = cluster.Promote(d.State(), d.gateway, nodes)
if err != nil {
return SmartError(err)
}
return SyncResponse(true, nil)
} | |
c176862 | := name[len(prefix):]
filters = append(filters, strings.Split(rest, "And"))
}
sort.SliceStable(filters, func(i, j int) bool {
return len(filters[i]) > len(filters[j])
})
return filters
} | |
c176863 |
return nil, errors.Wrapf(err, "Failed to parse %q", name)
}
m := &Mapping{
Package: pkg.Name,
Name: name,
Fields: fields,
}
return m, nil
} | |
c176864 | return nil
}
str, ok := typ.Type.(*ast.StructType)
if !ok {
return nil
}
return str
} | |
c176865 | return nil, errors.Wrapf(err, "Failed to parse parent struct")
}
fields = append(fields, parentFields...)
continue
}
if len(f.Names) != 1 {
return nil, fmt.Errorf("Expected a single field name, got %q", f.Names)
}
field, err := parseField(f)
if err != nil {
return nil, err
}
fields = append(fields, field)
}
return fields, nil
} | |
c176866 | err != nil {
return nil, err
}
// Parse it
names := []string{}
for _, url := range urls {
fields := strings.Split(url, "/profiles/")
names = append(names, strings.Split(fields[len(fields)-1], "?")[0])
}
return names, nil
} | |
c176867 | "", &profiles)
if err != nil {
return nil, err
}
return profiles, nil
} | |
c176868 | value
etag, err := r.queryStruct("GET", fmt.Sprintf("/profiles/%s", url.QueryEscape(name)), nil, "", &profile)
if err != nil {
return nil, "", err
}
return &profile, etag, nil
} | |
c176869 | profile, "")
if err != nil {
return err
}
return nil
} | |
c176870 | request
_, _, err := r.query("PUT", fmt.Sprintf("/profiles/%s", url.QueryEscape(name)), profile, ETag)
if err != nil {
return err
}
return nil
} | |
c176871 |
_, _, err := r.query("POST", fmt.Sprintf("/profiles/%s", url.QueryEscape(name)), profile, "")
if err != nil {
return err
}
return nil
} | |
c176872 | // Populate the initial values.
_, err := m.update(values)
return m, err
} | |
c176873 | {
values[name] = true
} else {
values[name] = value
}
}
}
return values
} | |
c176874 |
value, ok := m.values[name]
if !ok {
value = key.Default
}
return value
} | |
c176875 | {
m.schema.assertKeyType(name, String)
return m.GetRaw(name)
} | |
c176876 | return shared.IsTrue(m.GetRaw(name))
} | |
c176877 | {
panic(fmt.Sprintf("cannot convert to int64: %v", err))
}
return n
} | |
c176878 | m.set(name, value, initial)
if err != nil {
errors.add(name, value, err.Error())
continue
}
if changed {
names = append(names, name)
}
}
sort.Strings(names)
var err error
if errors.Len() > 0 {
errors.sort()
err = errors
}
return names, err
} | |
c176879 |
return false, nil
}
// Trigger the Setter if this is not an initial load and the key's
// schema has declared it.
if !initial && key.Setter != nil {
value, err = key.Setter(value)
if err != nil {
return false, err
}
}
if value == "" {
delete(m.values, name)
} else {
m.values[name] = value
}
return true, nil
} | |
c176880 | if !rows.Next() {
return false, fmt.Errorf("schema table query returned no rows")
}
var count int
err = rows.Scan(&count)
if err != nil {
return false, err
}
return count == 1, nil
} | |
c176881 | := `
SELECT version FROM schema ORDER BY version
`
return query.SelectIntegers(tx, statement)
} | |
c176882 | LIKE 'sqlite_%'
ORDER BY name
`
return query.SelectStrings(tx, statement)
} | |
c176883 | updated_at DATETIME NOT NULL,
UNIQUE (version)
)
`
_, err := tx.Exec(statement)
return err
} | |
c176884 | VALUES (?, strftime("%s"))
`
_, err := tx.Exec(statement, new)
return err
} | |
c176885 | cluster,
MAAS: maas,
OS: os,
Endpoints: endpoints,
}
} | |
c176886 | != nil {
c.c.Release()
c.c = nil
}
} | |
c176887 | ephemeral: args.Ephemeral,
architecture: args.Architecture,
cType: args.Ctype,
creationDate: args.CreationDate,
lastUsedDate: args.LastUsedDate,
profiles: args.Profiles,
localConfig: args.Config,
localDevices: args.Devices,
stateful: args.Stateful,
node: args.Node,
expiryDate: args.ExpiryDate,
}
} | |
c176888 | := storagePoolVolumeContainerLoadInit(c.state, c.Project(), c.Name())
if err != nil {
return err
}
c.storage = s
return nil
} | |
c176889 | c.expandedDevices[deviceName]
device["host_name"] = hostName
return c.setupHostVethDevice(device)
} | |
c176890 | if device["host_name"] == "" {
return fmt.Errorf("LXC doesn't know about this device and the host_name property isn't set, can't find host side veth name")
}
// Refresh tc limits
err := c.setNetworkLimits(device)
if err != nil {
return err
}
// Setup static routes to container
err = c.setNetworkRoutes(device)
if err != nil {
return err
}
return nil
} | |
c176891 | monitor <- c.State()
}(c.c)
select {
case state := <-monitor:
return state, nil
case <-time.After(5 * time.Second):
return lxc.StateMap["FROZEN"], LxcMonitorStateError
}
} | |
c176892 | isOurOperation, err = c.storage.ContainerSnapshotStart(c)
} else {
isOurOperation, err = c.storage.ContainerMount(c)
}
return isOurOperation, err
} | |
c176893 | := fmt.Sprintf("%s.%s", strings.Replace(prefix, "/", "-", -1), strings.Replace(relativeDestPath, "/", "-", -1))
devPath := filepath.Join(c.DevicesPath(), devName)
return shared.PathExists(devPath)
} | |
c176894 | to initialize storage volume \"%s\" of type \"%s\" on storage pool \"%s\": %s",
volumeName,
volumeTypeName,
m["pool"], err)
} else if err == nil {
_, err = s.StoragePoolVolumeMount()
if err != nil {
msg := fmt.Sprintf("Could not mount storage volume \"%s\" of type \"%s\" on storage pool \"%s\": %s.",
volumeName,
volumeTypeName,
m["pool"], err)
if !isOptional {
logger.Errorf(msg)
return "", err
}
logger.Warnf(msg)
}
}
}
// Check if the source exists
if !shared.PathExists(srcPath) {
if isOptional {
return "", nil
}
return "", fmt.Errorf("Source path %s doesn't exist for device %s", srcPath, name)
}
// Create the devices directory if missing
if !shared.PathExists(c.DevicesPath()) {
err := os.Mkdir(c.DevicesPath(), 0711)
if err != nil {
return "", err
}
}
// Clean any existing entry
if shared.PathExists(devPath) {
err := os.Remove(devPath)
if err != nil {
return "", err
}
}
// Create the mount point
if isFile {
f, err := os.Create(devPath)
if err != nil {
return "", err
}
f.Close()
} else {
err := os.Mkdir(devPath, 0700)
if err != nil {
return "", err
}
}
// Mount the fs
err := deviceMountDisk(srcPath, devPath, isReadOnly, isRecursive, m["propagation"])
if err != nil {
return "", err
}
return devPath, nil
} | |
c176895 | err != nil {
return err
}
// Add additional IPv4 routes
if m["ipv4.routes"] != "" {
for _, route := range strings.Split(m["ipv4.routes"], ",") {
route = strings.TrimSpace(route)
_, err := shared.RunCommand("ip", "-4", "route", "add", "dev", m["host_name"], route, "proto", "static")
if err != nil {
return err
}
}
}
// Add additional IPv6 routes
if m["ipv6.routes"] != "" {
for _, route := range strings.Split(m["ipv6.routes"], ",") {
route = strings.TrimSpace(route)
_, err := shared.RunCommand("ip", "-6", "route", "add", "dev", m["host_name"], route, "proto", "static")
if err != nil {
return err
}
}
}
return nil
} | |
c176896 | return containerPath(name, c.IsSnapshot())
} | |
c176897 | IPv4
if m["maas.subnet.ipv4"] != "" {
subnet := maas.ContainerInterfaceSubnet{
Name: m["maas.subnet.ipv4"],
Address: m["ipv4.address"],
}
subnets = append(subnets, subnet)
}
// IPv6
if m["maas.subnet.ipv6"] != "" {
subnet := maas.ContainerInterfaceSubnet{
Name: m["maas.subnet.ipv6"],
Address: m["ipv6.address"],
}
subnets = append(subnets, subnet)
}
iface := maas.ContainerInterface{
Name: m["name"],
MACAddress: m["hwaddr"],
Subnets: subnets,
}
interfaces = append(interfaces, iface)
}
return interfaces, nil
} | |
c176898 | !debug {
return log.LvlFilterHandler(
log.LvlInfo,
log.Must.SyslogHandler(syslog, format),
)
}
return log.Must.SyslogHandler(syslog, format)
}
return nil
} | |
c176899 | "Device Minor:")
if idx != -1 {
idx += len("Device Minor:")
strBuf = strBuf[idx:]
strBuf = strings.TrimSpace(strBuf)
parts := strings.SplitN(strBuf, "\n", 2)
_, err = strconv.Atoi(parts[0])
if err == nil {
return parts[0], nil
}
}
minor, err := findNvidiaMinorOld()
if err == nil {
return minor, nil
}
return "", err
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.