Commit e78d5fe6 authored by SIMONIN Matthieu's avatar SIMONIN Matthieu
Browse files

allow docker one liner

parent ad782302
Pipeline #193552 passed with stages
in 25 minutes and 56 seconds
......@@ -14,10 +14,6 @@ cmake .. && make
TODO c'est pas tout à fait ça :( (voir la chaîne de build dans le ci ou l'image docker).
# Example jouets
... TEC: Travail En Cours...
# Tests unitaires
Il y a des tests à différents niveau:
......@@ -49,12 +45,42 @@ simgrid. Il faut:
intercepte/réinjecte les communications vers/en provenance de simgrid)
```
./tansiv examples/qemus/nova_cluster.xml examples/qemus/deployment.xml --log=vm_interface.threshold:debug --log=vm_coordinator.threshold:debug
cd examples/qemus
../../tansiv nova_cluster.xml deployment.xml --log=vm_interface.threshold:debug --log=vm_coordinator.threshold:debug
```
# Run in docker
# Docker (par exemple sur g5k)
WiP
```
docker run -v $(pwd):/srv --device /dev/net/tun --cap-add=NET_ADMIN -ti --entrypoint bash registry.gitlab.inria.fr/msimonin/2018-vsg/tansiv:9458b5c2
g5k-setup-docker -t
cd examples/qemus
(get the debian-10.3.0-x86_64.qcow2 image)
docker run \
--network host \
--device /dev/net/tun \
--cap-add=NET_ADMIN \
-e AUTOCONFIG_NET=1 \
-e IMAGE=debian-10.3.0-x86_64.qcow2 \
-v /home/msimonin/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub \
-v $(pwd):/srv \
-ti registry.gitlab.inria.fr/msimonin/2018-vsg/tansiv:ad782302 nova_cluster.xml deployment.xml
```
ensuite (ça met un peu de temps à arriver)
```
# connection using the management interface should be able after some time
$) ssh -l root 172.16.0.10
# test d'un ping à travers vsg
root@tansiv-192-168-120-10:~# ping t11
PING t11 (192.168.120.11) 56(84) bytes of data.
64 bytes from t11 (192.168.120.11): icmp_seq=1 ttl=64 time=400 ms
64 bytes from t11 (192.168.120.11): icmp_seq=2 ttl=64 time=400 ms
```
......@@ -36,6 +36,7 @@ class TansivVM(object):
qemu_cmd: str,
qemu_image: Path(),
qemu_args: Optional[str] = None,
hostname: Optional[str] = None,
public_key: Optional[str] = None,
autoconfig_net: bool = False,
):
......@@ -43,6 +44,7 @@ class TansivVM(object):
self.management = ip_management
self.qemu_cmd = qemu_cmd
self.qemu_image = qemu_image.resolve()
self._hostname = hostname
self.public_key = public_key
self.autoconfig_net = autoconfig_net
......@@ -68,7 +70,9 @@ class TansivVM(object):
@property
def hostname(self) -> str:
return f"tansiv-{str(self.tantap.ip).replace('.', '-')}"
if self._hostname is None:
return f"tansiv-{str(self.tantap.ip).replace('.', '-')}"
return self._hostname
@property
def tapname(self) -> List[str]:
......@@ -266,6 +270,7 @@ done
""",
formatter_class=argparse.RawTextHelpFormatter,
)
parser.add_argument(
"ip_tantap",
type=str,
......@@ -277,6 +282,12 @@ done
type=str,
help="The ip (in cidr) to use for the management interface",
)
parser.add_argument(
"--hostname",
type=str,
help="The hostname of the virtual machine",
)
parser.add_argument("--qemu-args", type=str, help="arguments to pass to qemu")
......@@ -286,6 +297,7 @@ done
ip_tantap = IPv4Interface(args.ip_tantap)
ip_management = IPv4Interface(args.ip_management)
qemu_args = args.qemu_args
hostname = args.hostname
# get the mandatory variables from the env
qemu_cmd = from_env(ENV_QEMU)
......@@ -304,6 +316,7 @@ done
qemu_cmd=qemu_cmd,
qemu_image=qemu_image,
qemu_args=qemu_args,
hostname=hostname,
public_key=public_key,
autoconfig_net=autoconfig_net,
)
......
......@@ -4,21 +4,21 @@
<actor host="nova-1.lyon.grid5000.fr" function="vsg_vm">
<argument value="192.168.120.10"/> <!-- how simgrid knows me-->
<argument value="./examples/qemus/boot.py"/>
<argument value="./boot.py"/>
<argument value="192.168.120.10/24"/> <!-- how vsg knows me-->
<argument value="172.16.0.10/24"/> <!-- management -->
</actor>
<actor host="nova-2.lyon.grid5000.fr" function="vsg_vm">
<argument value="192.168.120.11"/> <!-- how simgrid knows me-->
<argument value="./examples/qemus/boot.py"/>
<argument value="./boot.py"/>
<argument value="192.168.120.11/24"/> <!-- how vsg knows me-->
<argument value="172.16.0.11/24"/> <!-- management -->
</actor>
<actor host="nova-2.lyon.grid5000.fr" function="vsg_vm">
<actor host="nova-3.lyon.grid5000.fr" function="vsg_vm">
<argument value="192.168.120.12"/> <!-- how simgrid knows me-->
<argument value="./examples/qemus/boot.py"/>
<argument value="./boot.py"/>
<argument value="192.168.120.12/24"/> <!-- how vsg knows me-->
<argument value="172.16.0.12/24"/> <!-- management -->
</actor>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment