Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
[fabiand@tee Downloads]$ k logs v2v-4d9b8
+ echo /v2v-dst ova http://192.168.42.1:8000/my.ova ''
+ DSTD=/v2v-dst
/v2v-dst ova http://192.168.42.1:8000/my.ova
+ SRCTYPE=ova
+ SRC=http://192.168.42.1:8000/my.ova
+ SRCURI=
++++ readlink -f /v2v.d/bin/job
+++ dirname /v2v.d/bin/job
++ readlink -f /v2v.d/bin/..
+ BASEDIR=/v2v.d
+ main
+ [[ -n /v2v-dst ]]
+ [[ -n ova ]]
+ [[ -n http://192.168.42.1:8000/my.ova ]]
+ [[ http://192.168.42.1:8000/my.ova = \e\x\a\m\p\l\e ]]
+ [[ http://192.168.42.1:8000/my.ova =~ ^http ]]
+ curl -LO http://192.168.42.1:8000/my.ova
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 687M 100 687M 0 0 94.7M 0 0:00:07 0:00:07 --:--:-- 82.8M
++ basename http://192.168.42.1:8000/my.ova
+ SRC=my.ova
+ [[ ova = \d\i\s\k ]]
+ [[ ova = \l\i\b\v\i\r\t ]]
+ transformVM ova my.ova ''
+ local SRCTYPE=ova
+ local SRC=my.ova
+ local SRCURI=
++ basename my.ova
+ local WD=my.ova.d
+ echo ' Converting source: my.ova'
Converting source: my.ova
+ mkdir -p my.ova.d
+ ls -shal my.ova
688M -rw-r--r-- 1 root root 688M Mar 6 10:15 my.ova
++ basename my.ova
++ tr '[:upper:]' '[:lower:]'
++ sed 's/[^a-zA-Z0-9-]/-/g'
+ local NAME=my-ova
+ [[ -n '' ]]
+ virt-v2v -i ova my.ova -o local -on my-ova -oa sparse -of raw -os my.ova.d --machine-readable
[ 0.0] Opening the source -i ova my.ova
virt-v2v: warning: ova disk has an unknown VMware controller type (20),
please report this as a bug supplying the *.ovf file extracted from the ova
[ 2.8] Creating an overlay to protect the source from being modified
[ 2.8] Initializing the target -o local -os my.ova.d
[ 2.8] Opening the overlay
[fabiand@tee Downloads]$ k logs v2v-4d9b8 -f
+ echo /v2v-dst ova http://192.168.42.1:8000/my.ova ''
+ DSTD=/v2v-dst
/v2v-dst ova http://192.168.42.1:8000/my.ova
+ SRCTYPE=ova
+ SRC=http://192.168.42.1:8000/my.ova
+ SRCURI=
++++ readlink -f /v2v.d/bin/job
+++ dirname /v2v.d/bin/job
++ readlink -f /v2v.d/bin/..
+ BASEDIR=/v2v.d
+ main
+ [[ -n /v2v-dst ]]
+ [[ -n ova ]]
+ [[ -n http://192.168.42.1:8000/my.ova ]]
+ [[ http://192.168.42.1:8000/my.ova = \e\x\a\m\p\l\e ]]
+ [[ http://192.168.42.1:8000/my.ova =~ ^http ]]
+ curl -LO http://192.168.42.1:8000/my.ova
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 687M 100 687M 0 0 94.7M 0 0:00:07 0:00:07 --:--:-- 82.8M
++ basename http://192.168.42.1:8000/my.ova
+ SRC=my.ova
+ [[ ova = \d\i\s\k ]]
+ [[ ova = \l\i\b\v\i\r\t ]]
+ transformVM ova my.ova ''
+ local SRCTYPE=ova
+ local SRC=my.ova
+ local SRCURI=
++ basename my.ova
+ local WD=my.ova.d
+ echo ' Converting source: my.ova'
Converting source: my.ova
+ mkdir -p my.ova.d
+ ls -shal my.ova
688M -rw-r--r-- 1 root root 688M Mar 6 10:15 my.ova
++ basename my.ova
++ tr '[:upper:]' '[:lower:]'
++ sed 's/[^a-zA-Z0-9-]/-/g'
+ local NAME=my-ova
+ [[ -n '' ]]
+ virt-v2v -i ova my.ova -o local -on my-ova -oa sparse -of raw -os my.ova.d --machine-readable
[ 0.0] Opening the source -i ova my.ova
virt-v2v: warning: ova disk has an unknown VMware controller type (20),
please report this as a bug supplying the *.ovf file extracted from the ova
[ 2.8] Creating an overlay to protect the source from being modified
[ 2.8] Initializing the target -o local -os my.ova.d
[ 2.8] Opening the overlay
[ 14.3] Inspecting the overlay
[ 24.8] Checking for sufficient free disk space in the guest
[ 24.8] Estimating space required on target for each disk
[ 24.8] Converting Red Hat Enterprise Linux Client 7.0 (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 191.6] Mapping filesystem data to avoid copying unused and blank areas
[ 192.9] Closing the overlay
[ 193.1] Checking if the guest needs BIOS or UEFI to boot
[ 193.1] Assigning disks to buses
[ 193.1] Copying disk 1/1 to my.ova.d/my-ova-sda (raw)
(100.00/100%)
[ 215.2] Creating output metadata
[ 215.2] Finishing off
++ ls my.ova.d/my-ova.xml
+ local DOMXML=my.ova.d/my-ova.xml
+ local VMYAML=my.ova.d/my-ova.yaml
+ tee my.ova.d/my-ova.yaml
+ xsltproc /v2v.d/data/toVMSpec.xsl my.ova.d/my-ova.xml
# Generate by v2v-job
apiVersion: kubevirt.io/v1alpha1
kind: OfflineVirtualMachine
metadata:
name: my-ova
spec:
template:
terminationGracePeriodSeconds: 0
domain:
cpu:
cores: 1
resources:
requests:
memory: 2097152KiB
devices:
disks:
- name: disk-1
disk:
bus: virtio
volumeName: volume-1
- name: disk-2
cdrom:
bus: ide
- name: disk-3
floppy:
bus:
volumes:
- name: volume-1
persistentVolumeClaim:
name: my-ova-disk-1
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-ova-disk-1
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 8Gi
++ xmllint --xpath 'count(//disk[@type='\''file'\'']/source)' my.ova.d/my-ova.xml
+ [[ 1 -gt 1 ]]
++ xmllint --xpath 'string(//disk[@type='\''file'\'']/source/@file)' my.ova.d/my-ova.xml
+ local DISKFILE=/v2v.d/my.ova.d/my-ova-sda
+ cp -v /v2v.d/my.ova.d/my-ova-sda /v2v-dst/disk.raw
'/v2v.d/my.ova.d/my-ova-sda' -> '/v2v-dst/disk.raw'
+ cp -v my.ova.d/my-ova.yaml /v2v-dst/vm.yaml
+ ls -shal /v2v-dst
'my.ova.d/my-ova.yaml' -> '/v2v-dst/vm.yaml'
total 1.4G
4.0K drwxrwxrwx 2 root root 4.0K Mar 6 10:19 .
4.0K drwxr-xr-x 1 root root 4.0K Mar 6 10:15 ..
1.4G -rw-r--r-- 1 root root 4.0G Mar 6 10:19 disk.raw
4.0K -rw-r--r-- 1 root root 804 Mar 6 10:19 vm.yaml
+ createEntities
+ local VMYAML=/v2v-dst/vm.yaml
+ local DISKFILE=/v2v-dst/disk.raw
++ cut -d: -f2
++ sed 's/^\s\+//'
++ tail -n1
++ egrep '^\s+name:'
+ local PVCNAME=my-ova-disk-1
+ kubectl create -f /v2v-dst/vm.yaml
offlinevirtualmachine "my-ova" created
persistentvolumeclaim "my-ova-disk-1" created
+ sleep 4.2s
+ tee receiver.yaml
+ kubectl create -f receiver.yaml
apiVersion: v1
kind: Pod
metadata:
name: v2v-receiver-my-ova-disk-1
labels:
receiver-for: my-ova-disk-1
spec:
restartPolicy: Never
containers:
- name: v2v
image: quay.io/fabiand/v2v-pv-populator
volumeMounts:
- name: dst
mountPath: /dst
volumes:
- name: dst
persistentVolumeClaim:
claimName: my-ova-disk-1
---
apiVersion: v1
kind: Service
metadata:
labels:
receiver-for: my-ova-disk-1
name: v2v-receiver-my-ova-disk-1
spec:
ports:
- port: 54321
protocol: TCP
targetPort: 54321
selector:
receiver-for: my-ova-disk-1
type: ClusterIP
pod "v2v-receiver-my-ova-disk-1" created
service "v2v-receiver-my-ova-disk-1" created
+ sleep 4.2s
+ local N=30
+ [[ 30 -gt 0 ]]
+ echo 'Trial 30 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Trial 30 to send data
Ncat: Connection timed out.
+ sleep 10
+ N=29
+ [[ 29 -gt 0 ]]
+ echo 'Trial 29 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Trial 29 to send data
Ncat: Connection timed out.
+ sleep 10
Trial 28 to send data
+ N=28
+ [[ 28 -gt 0 ]]
+ echo 'Trial 28 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Ncat: Connection timed out.
+ sleep 10
Trial 27 to send data
+ N=27
+ [[ 27 -gt 0 ]]
+ echo 'Trial 27 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Ncat: Connection timed out.
+ sleep 10
Trial 26 to send data
+ N=26
+ [[ 26 -gt 0 ]]
+ echo 'Trial 26 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Ncat: Connection timed out.
+ sleep 10
+ N=25
+ [[ 25 -gt 0 ]]
+ echo 'Trial 25 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Trial 25 to send data
Ncat: Connection timed out.
+ sleep 10
+ N=24
+ [[ 24 -gt 0 ]]
+ echo 'Trial 24 to send data'
+ nc v2v-receiver-my-ova-disk-1 54321
Trial 24 to send data
+ break
+ [[ 24 = 0 ]]
+ echo 'Data transmitted!'
+ kubectl delete -f receiver.yaml
Data transmitted!
pod "v2v-receiver-my-ova-disk-1" deleted
service "v2v-receiver-my-ova-disk-1" deleted
[fabiand@tee Downloads]$ k get ovm,pvc
NAME AGE
offlinevirtualmachines/my-ova 4m
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc/my-ova-disk-1 Bound pvc-d312ce36-2127-11e8-b8f8-38099d4f9f2e 8Gi RWO standard 4m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment