test: Set the fixed uuid for the default XMLs

The objects (domain, pool, network, etc) for testing are defined/
started each time when opening a connect to test driver, and thus
the UUID for the objects will be generated each time, with different
values. e.g.

% for i in {1..3}; do ./tools/virsh --connect \
  test:///default dumpxml test | grep uuid; done
  <uuid>a1b6ee1f-97de-f0ee-617a-0cdb74947df5</uuid>
  <uuid>ee68d7d2-3eb9-593e-2769-797ce1f4c4aa</uuid>
  <uuid>fecb1d3a-918a-8412-e534-76192cf32b18</uuid>

It's the potential bug which can cause operations like below to fail:

$ virsh -c test:///default dumpxml test > test.xml

[ Some modificatons, though it's not supported, but it should work ]

$ virsh -c test:///default define test.xml

This patch set fixed UUID for objects which support it. (domain,
pool, network).
This commit is contained in:
Osier Yang 2012-04-17 22:53:51 +08:00
parent a4cda054e7
commit 4010217e73

View File

@ -230,6 +230,7 @@ no_memory:
static const char *defaultDomainXML =
"<domain type='test'>"
" <name>test</name>"
" <uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>"
" <memory>8388608</memory>"
" <currentMemory>2097152</currentMemory>"
" <vcpu>2</vcpu>"
@ -242,6 +243,7 @@ static const char *defaultDomainXML =
static const char *defaultNetworkXML =
"<network>"
" <name>default</name>"
" <uuid>dd8fe884-6c02-601e-7551-cca97df1c5df</uuid>"
" <bridge name='virbr0' />"
" <forward/>"
" <ip address='192.168.122.1' netmask='255.255.255.0'>"
@ -265,6 +267,7 @@ static const char *defaultInterfaceXML =
static const char *defaultPoolXML =
"<pool type='dir'>"
" <name>default-pool</name>"
" <uuid>dfe224cb-28fb-8dd0-c4b2-64eb3f0f4566</uuid>"
" <target>"
" <path>/default-pool</path>"
" </target>"