提交 f67bf6e9 编写于 作者: K Kiarie Kahurani 提交者: Jim Fehlig

src/xenconfig: wrap common formatting code

Wrap formatting code common to xm and xl in xenFormatConfigCommon
and export it.
Signed-off-by: NKiarie Kahurani <davidkiarie4@gmail.com>
Signed-off-by: NJim Fehlig <jfehlig@suse.com>
上级 512f6738
......@@ -2359,66 +2359,79 @@ xenFormatXMVif(virConfPtr conf,
}
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough. */
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
virConfPtr
xenFormatXM(virConnectPtr conn,
virDomainDefPtr def,
int xendConfigVersion)
int
xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virConnectPtr conn,
int xendConfigVersion)
{
virConfPtr conf = NULL;
if (!(conf = virConfNew()))
goto cleanup;
if (xenFormatXMGeneralMeta(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMMem(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMCPUAllocation(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMOS(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion) < 0)
goto cleanup;
return -1;;
if (xenFormatXMCDROM(conf, def, xendConfigVersion) < 0)
goto cleanup;
return -1;
if (xenFormatXMTimeOffset(conf, def, xendConfigVersion) < 0)
goto cleanup;
return -1;
if (xenFormatXMEventActions(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMEmulator(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMInputDevs(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMVfb(conf, def, xendConfigVersion) < 0)
goto cleanup;
if (xenFormatXMDisks(conf, def, xendConfigVersion) < 0)
goto cleanup;
return -1;
if (xenFormatXMVif(conf, conn, def, xendConfigVersion) < 0)
goto cleanup;
return -1;
if (xenFormatXMPCI(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMCharDev(conf, def) < 0)
goto cleanup;
return -1;
if (xenFormatXMSound(conf, def) < 0)
return -1;
return 0;
}
/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough. */
verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
virConfPtr
xenFormatXM(virConnectPtr conn,
virDomainDefPtr def,
int xendConfigVersion)
{
virConfPtr conf = NULL;
if (!(conf = virConfNew()))
goto cleanup;
if (xenFormatConfigCommon(conf, def, conn, xendConfigVersion) < 0)
goto cleanup;
if (xenFormatXMDisks(conf, def, xendConfigVersion) < 0)
goto cleanup;
return conf;
......
......@@ -41,4 +41,9 @@ int xenParseConfigCommon(virConfPtr conf,
virCapsPtr caps,
int xendConfigVersion);
int xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virConnectPtr conn,
int xendConfigVersion);
#endif /* __VIR_XEN_XM_H__ */
......@@ -19,8 +19,8 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", """phy:/dev/HostVG/XenGuest'",hdb,w""", "file:/root/boot.iso&test,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
soundhw = "sb16,es1370"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", """phy:/dev/HostVG/XenGuest'",hdb,w""", "file:/root/boot.iso&test,hdc:cdrom,r" ]
......@@ -20,7 +20,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -20,7 +20,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,type=netfront" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -20,7 +20,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,ioemu:hda,w" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr0,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,ioemu:hda,w" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "tcp:127.0.0.1:7777"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = [ "/dev/ttyS0", "/dev/ttyS1" ]
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = [ "none", "/dev/ttyS1" ]
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "file:/tmp/serial.log"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "null"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "pipe:/tmp/serial.pipe"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "pty"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "stdio"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "telnet:127.0.0.1:9999,server,nowait"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "tcp:127.0.0.1:7777"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "udp:127.0.0.1:9999@0.0.0.0:99998"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "unix:/tmp/serial.sock,server,nowait"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,8 +19,8 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
soundhw = "sb16,es1370"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -21,7 +21,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -21,7 +21,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -19,7 +19,7 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "none"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
......@@ -17,7 +17,7 @@ device_model = "/usr/lib/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
disk = [ "phy:/dev/sda8,hda,w", ",hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:0a:7b:39,bridge=xenbr0,script=vif-bridge,model=e1000,type=ioemu" ]
parallel = "none"
serial = "pty"
disk = [ "phy:/dev/sda8,hda,w", ",hdc:cdrom,r" ]
......@@ -9,5 +9,5 @@ on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge,model=e1000" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -9,5 +9,5 @@ on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge,model=e1000,vifname=net0" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -9,5 +9,5 @@ on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = [ "type=vnc,vncunused=0,vncdisplay=25,vnclisten=127.0.0.1,vncpasswd=123poi" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -9,5 +9,5 @@ on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -14,5 +14,5 @@ vncunused = 0
vncdisplay = 25
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -13,5 +13,5 @@ vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -9,5 +9,5 @@ localtime = 0
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
......@@ -17,8 +17,8 @@ device_model = "/usr/lib/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
disk = [ "phy:/dev/sda8,hda,w", ",hdc:cdrom,r" ]
vif = [ "mac=00:16:3e:0a:7b:39,bridge=xenbr0,script=vif-bridge,model=e1000,type=ioemu" ]
pci = [ "0001:0c:1b.2", "0000:01:13.0" ]
parallel = "none"
serial = "pty"
disk = [ "phy:/dev/sda8,hda,w", ",hdc:cdrom,r" ]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册