(availableSize uint64, desiredSwapSizeInBytes *uint64, partitionPath string, partitionStartCount int, partitioner boshdisk.Partitioner, labelPrefix string)
| 1810 | } |
| 1811 | |
| 1812 | func (p linux) partitionDisk(availableSize uint64, desiredSwapSizeInBytes *uint64, partitionPath string, partitionStartCount int, partitioner boshdisk.Partitioner, labelPrefix string) (string, string, error) { |
| 1813 | p.logger.Debug(logTag, "Calculating partition sizes of `%s', with available size %dB", partitionPath, availableSize) |
| 1814 | |
| 1815 | swapSizeInBytes, linuxSizeInBytes, err := p.calculateEphemeralDiskPartitionSizes(availableSize, desiredSwapSizeInBytes) |
| 1816 | if err != nil { |
| 1817 | return "", "", bosherr.WrapError(err, "Calculating partition sizes") |
| 1818 | } |
| 1819 | |
| 1820 | var partitions []boshdisk.Partition |
| 1821 | var swapPartitionPath string |
| 1822 | var dataPartitionPath string |
| 1823 | |
| 1824 | labelPrefix = prepareDiskLabelPrefix(labelPrefix) |
| 1825 | if swapSizeInBytes == 0 { |
| 1826 | partitions = []boshdisk.Partition{ |
| 1827 | {NamePrefix: labelPrefix, SizeInBytes: linuxSizeInBytes, Type: boshdisk.PartitionTypeLinux}, |
| 1828 | } |
| 1829 | swapPartitionPath = "" |
| 1830 | dataPartitionPath = p.partitionPath(partitionPath, partitionStartCount) |
| 1831 | } else { |
| 1832 | partitions = []boshdisk.Partition{ |
| 1833 | {NamePrefix: labelPrefix, SizeInBytes: swapSizeInBytes, Type: boshdisk.PartitionTypeSwap}, |
| 1834 | {NamePrefix: labelPrefix, SizeInBytes: linuxSizeInBytes, Type: boshdisk.PartitionTypeLinux}, |
| 1835 | } |
| 1836 | swapPartitionPath = p.partitionPath(partitionPath, partitionStartCount) |
| 1837 | dataPartitionPath = p.partitionPath(partitionPath, partitionStartCount+1) |
| 1838 | } |
| 1839 | |
| 1840 | p.logger.Info(logTag, "Partitioning `%s' with %s", partitionPath, partitions) |
| 1841 | err = partitioner.Partition(partitionPath, partitions) |
| 1842 | |
| 1843 | return swapPartitionPath, dataPartitionPath, err |
| 1844 | } |
| 1845 | |
| 1846 | func (p linux) RemoveDevTools(packageFileListPath string) error { |
| 1847 | content, err := p.fs.ReadFileString(packageFileListPath) |
no test coverage detected