fix storage management and nfs
This commit is contained in:
@@ -958,6 +958,41 @@ func (s *Service) DestroyDataset(name string, recursive bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateDataset updates ZFS dataset properties
|
||||
func (s *Service) UpdateDataset(name string, quota string, compression string, options map[string]string) error {
|
||||
// Update quota if provided
|
||||
if quota != "" {
|
||||
quotaValue := quota
|
||||
if quota == "none" || quota == "0" {
|
||||
quotaValue = "none"
|
||||
}
|
||||
args := []string{"set", fmt.Sprintf("quota=%s", quotaValue), name}
|
||||
if _, err := s.execCommand(s.zfsPath, args...); err != nil {
|
||||
return translateZFSError(err, "mengupdate quota dataset", name)
|
||||
}
|
||||
}
|
||||
|
||||
// Update compression if provided
|
||||
if compression != "" {
|
||||
args := []string{"set", fmt.Sprintf("compression=%s", compression), name}
|
||||
if _, err := s.execCommand(s.zfsPath, args...); err != nil {
|
||||
return translateZFSError(err, "mengupdate compression dataset", name)
|
||||
}
|
||||
}
|
||||
|
||||
// Update other options if provided
|
||||
if options != nil {
|
||||
for key, value := range options {
|
||||
args := []string{"set", fmt.Sprintf("%s=%s", key, value), name}
|
||||
if _, err := s.execCommand(s.zfsPath, args...); err != nil {
|
||||
return translateZFSError(err, fmt.Sprintf("mengupdate property %s dataset", key), name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListZVOLs returns all ZVOLs
|
||||
func (s *Service) ListZVOLs(pool string) ([]models.ZVOL, error) {
|
||||
args := []string{"list", "-H", "-o", "name,volsize,used", "-t", "volume"}
|
||||
|
||||
Reference in New Issue
Block a user