]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: Set the fixed uuid for the default XMLs
authorOsier Yang <jyang@redhat.com>
Tue, 17 Apr 2012 14:53:51 +0000 (22:53 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 17 Apr 2012 14:53:51 +0000 (22:53 +0800)
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).

src/test/test_driver.c

index 1587958c2d9ddd4b435fbdb8afbcb2f5e45cf5a1..39ac503d902b50f9866c88628bc676798f3d3ab7 100644 (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>"