bareon/fuel_agent/utils/fs_utils.py
Vladimir Kozhukalov 7730a743bb Added Fuel agent
Fuel agent is a bunch of tools which are
supposed to be placed on bootstrap image and
used for node discovering and image based
provisioning.

Implements: blueprint image-based-provisioning
Change-Id: I946decd50c51e6db767401682d9effbe3cf42bed
2014-07-10 19:05:58 +04:00

30 lines
1.1 KiB
Python

# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from fuel_agent.utils import utils
def make_fs(fs_type, fs_options, fs_label, dev):
# NOTE(agordeev): notice the different flag to force the fs creating
# ext* uses -F flag, xfs/mkswap uses -f flag.
cmd_line = []
cmd_name = 'mkswap'
if fs_type is not 'swap':
cmd_name = 'mkfs.%s' % fs_type
cmd_line.append(cmd_name)
for opt in (fs_options, fs_label):
cmd_line.extend([s for s in opt.split(' ') if s])
cmd_line.append(dev)
utils.execute(*cmd_line)