link_config['upload_extra-delay'] = os.path.basename(link_config['upload_extra-delay']);
cmd_line += pipe_build(link_config, "upload_extra-delay", " extra-delay ")
else:
- link_config['extra-delay'] = os.path.basename(link_config['extra-delay']);
cmd_line += pipe_build(link_config, "extra-delay", " extra-delay ")
# add plr, bw, delay, noerror
from PLC.Methods.GetBootMedium import compute_key # key generation function
WORK_DIR = "/var/tmp/DummynetBoxMedium"
-BASE_IMAGE = "/usr/share/dummynet/picobsd.bin"
+BASE_IMAGE = "/usr/share/dummynet/picobsd"
class GetDummyBoxMedium(Method):
"""
accepts = [
Auth(),
- Parameter(int, "A dummybox_id")
+ Parameter(int, "The dummybox_id"),
+ Parameter(str, "The image type (bin or iso)")
]
returns = Parameter(str, "DummynetBox boot medium")
return
# Here starts the execution of the call
- def call(self, auth, dummybox_id):
+ def call(self, auth, dummybox_id, type):
# Check for dummybox existence
dummyboxes = DummyBoxes(self.api, [dummybox_id])
# Get the dummynet box hostname
dummybox_hostname = dummybox['hostname']
- IMAGE_NAME = str(WORK_DIR) + "/dummybox_" + dummybox_hostname + ".bin"
+
+ # Select the base image, default to bin image
+ if type != 'iso':
+ type="bin"
+ IMAGE_NAME = str(WORK_DIR) + "/dummybox_" + dummybox_hostname + str(type)
+ BASE_IMAGE = BASE_IMAGE + "." + str(type)
configfile = WORK_DIR + '/dummybox.conf'
lockfile = WORK_DIR + '/lockfile'
shell_script = "(cp %s %s; export MATCH=`grep -abo START_USER_DATA %s | cut -d: -f1`; " \
% (BASE_IMAGE, IMAGE_NAME, IMAGE_NAME)
+ # set permission file
+ shell_script += " chmod u+w %s; chmod u+w %s; " % (IMAGE_NAME, configfile)
+
# cat the configuration file in the raw image
shell_script += "cat %s | dd of=%s seek=$MATCH conv=notrunc bs=1)" \
% (configfile, IMAGE_NAME)