Exemplo n.º 1
0
 def EnableHostonlyInterface(self):
     subutai.Information("Enabling host-only interface")
     adapterName = subutai.GetVBoxHostOnlyInterface()
     if adapterName == 'undefined':
         subutai.Information("Setting up host-only interface " +
                             adapterName)
         adapter = adapterName.replace(' ', '+++')
         subutai.VBox("hostonlyif create")
         adapter = subutai.GetVBoxHostOnlyInterface()
         subutai.VBox("hostonlyif ipconfig " + adapter +
                      " --ip 192.168.56.1")
         out = subutai.VBox("list dhcpservers")
         if out == '':
             subutai.Information("Configuring DHCP server on " +
                                 adapterName)
             subutai.VBox(
                 "dhcpserver add --ifname " + adapter +
                 " --ip 192.168.56.1 --netmask 255.255.255.0 --lowerip 192.168.56.100 --upperip 192.168.56.200"
             )
             subutai.VBox("dhcpserver modify --ifname " + adapter +
                          " --enable")
     return 0
Exemplo n.º 2
0
 def calculateTotal(self):
     t = 0
     t = t + self.coreSize
     t = t + self.vboxSize
     t = t + self.ubuntuSize
     t = t + self.openjreSize
     t = t + self.managementSize
     t = t + self.p2pSize
     t = t + self.tuntapSize
     t = t + self.cocoasudoSize
     t = t + self.traySize
     t = t + self.libsshSize
     t = t + self.chromeSize
     t = t + self.nssmSize
     self.totalSize = t
     subutai.Information("Total size calculated")
Exemplo n.º 3
0
    def __installTuntap(self):
        subutai.SetStep("TAPINST")
        subutai.AddStatus("Downloading TUN/TAP driver")
        subutai.download(self.TapFile)
        while subutai.isDownloadComplete() != 1:
            sleep(0.05)
            self.progress.setTuntapProgress(subutai.GetBytesDownload())
            self.progress.updateProgress()

        self.progress.setTuntapProgress(self.progress.getTuntapSize())
        self.progress.updateProgress()
        subutai.Information("Running TAP installation")
        subutai.AddStatus("Installing TUN/TAP driver")
        r = call([self.tmp + self.TapFile, '/S'])
        if r != 0:
            subutai.RaiseError("Failed to install TUN/TAP Driver")
        return r
Exemplo n.º 4
0
    def PreconfigureNetwork(self):
        subutai.AddStatus("Configuring Network")
        subutai.SetAction("NETPCONF")
        subutai.VBox("modifyvm " + self.name + " --nic1 nat")
        subutai.VBox("modifyvm " + self.name + " --cableconnected1 on")
        subutai.VBox(
            "modifyvm " + self.name +
            " --natpf1 ssh-fwd,tcp,,4567,,22 --natpf1 https-fwd,tcp,,9999,,8443"
        )
        subutai.VBox("modifyvm " + self.name + " --rtcuseutc on")
        adapterName = subutai.GetVBoxHostOnlyInterface()
        adapter = adapterName.replace(' ', '+++')
        if adapter != 'undefined':
            subutai.Information("Enabling host-only adapter " + adapterName)
            subutai.VBox("modifyvm " + self.name +
                         " --nic3 hostonly --hostonlyadapter3 " + adapter)

        return 0
Exemplo n.º 5
0
def InstallVirtualBox(tmp, install, progress):
    subutai.AddStatus("Downloading VirtualBox")
    subutai.download(GetVirtualBoxName())
    while subutai.isDownloadComplete() != 1:
        sleep(0.05)
        progress.setVboxProgress(subutai.GetBytesDownload())
        progress.updateProgress()

    progress.setVboxProgress(progress.getVboxSize())
    progress.updateProgress()
    try:
        subutai.AddStatus("Installing VirtualBox")
        postinst = subuco.PostInstall(tmp)
        postinst.append('dpkg -i ' + tmp + GetVirtualBoxName())
        postinst.append('modprobe vboxdrv >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxnetflt >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxnetadp >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxpci >> /tmp/subutai/vbox.log 2>&1')
        postinst.append("apt-get install -f -y")
        postinst.append('cat /tmp/subutai/vbox.log')
        p = run([
            '/usr/bin/gksudo', '--message', 'Install VirtualBox',
            postinst.get()
        ],
                stdout=PIPE,
                stderr=PIPE,
                encoding="utf-8")
        if p.stdout != '':
            subutai.Information(p.stdout)
        if p.stderr != '':
            subutai.Error(p.stderr)
    except:
        subutai.RaiseError("Failed to install VirtualBox. Aborting")
        return 45
    if not CheckVirtualBox():
        subutai.RaiseError("Failed to install VirtualBox. Aborting")
        return 24

    return 0