[libvirt] [PATCH] Do not enforce source type of console[0]
by Jan Kiszka
If console[0] is an alias for serial[0], do not enforce the former to
have a PTY source type. This breaks serial consoles on stdio and makes
no sense.
Signed-off-by: Jan Kiszka <jan.kiszka(a)siemens.com>
---
src/qemu/qemu_process.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ef311d1..216b594 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1376,7 +1376,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm,
if ((ret = virDomainChrSourceDefCopy(&chr->source,
&((vm->def->serials[0])->source))) != 0)
return ret;
- chr->source.type = VIR_DOMAIN_CHR_TYPE_PTY;
} else {
if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY &&
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
--
1.7.3.4
12 years, 7 months
[libvirt] [PATCH] openvz: wire up more node information functions
by Guido Günther
in detail nodeGetCPUStats, nodeGetMemoryStats, nodeGetCellsFreeMemory
and nodeGetFreeMemory
---
src/openvz/openvz_driver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 3b2ffea..41fd8e4 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1704,6 +1704,10 @@ static virDriver openvzDriver = {
.version = openvzGetVersion, /* 0.5.0 */
.getMaxVcpus = openvzGetMaxVCPUs, /* 0.4.6 */
.nodeGetInfo = nodeGetInfo, /* 0.3.2 */
+ .nodeGetCPUStats = nodeGetCPUStats, /* 0.9.11 */
+ .nodeGetMemoryStats = nodeGetMemoryStats, /* 0.9.11 */
+ .nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.9.11 */
+ .nodeGetFreeMemory = nodeGetFreeMemory, /* 0.9.11 */
.getCapabilities = openvzGetCapabilities, /* 0.4.6 */
.listDomains = openvzListDomains, /* 0.3.1 */
.numOfDomains = openvzNumDomains, /* 0.3.1 */
--
1.7.9.5
12 years, 7 months
[libvirt] OpenSSH authentification in Java libvirt API
by Alexandre Garnier
Hello,
It seems that today you can’t authenticate on a qemu+ssh connection via
OpenSSH without having to manually type the password in CLI or a pop-up
window, using the Java API for libvirt.
Being able to push a String in OpenSSH user input would be an easier and
faster solution, for the end-user.
Sincerely,
Alexandre
12 years, 7 months
[libvirt] [PATCH v2] qemuProcessStart: Switch to flags instead of bunch booleans
by Michal Privoznik
Currently, we have 3 boolean arguments we have to pass
to qemuProcessStart(). As libvirt grows it is harder and harder
to remember them and their position. Therefore we should
switch to flags instead.
---
diff to v1:
-fix a test for START_PAUSED flag
src/qemu/qemu_driver.c | 45 +++++++++++++++++++++++++++++----------------
src/qemu/qemu_migration.c | 7 ++++---
src/qemu/qemu_process.c | 21 +++++++++++++--------
src/qemu/qemu_process.h | 12 ++++++++----
4 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 65ed290..436ef37 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1351,10 +1351,16 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
virDomainPtr dom = NULL;
virDomainEventPtr event = NULL;
virDomainEventPtr event2 = NULL;
+ unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD;
virCheckFlags(VIR_DOMAIN_START_PAUSED |
VIR_DOMAIN_START_AUTODESTROY, NULL);
+ if (flags & VIR_DOMAIN_START_PAUSED)
+ start_flags |= VIR_QEMU_PROCESS_START_PAUSED;
+ if (flags & VIR_DOMAIN_START_AUTODESTROY)
+ start_flags |= VIR_QEMU_PROCESS_START_AUTODESROY;
+
qemuDriverLock(driver);
if (!(def = virDomainDefParseString(driver->caps, xml,
QEMU_EXPECTED_VIRT_TYPES,
@@ -1383,10 +1389,9 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; /* XXXX free the 'vm' we created ? */
- if (qemuProcessStart(conn, driver, vm, NULL, true,
- (flags & VIR_DOMAIN_START_PAUSED) != 0,
- (flags & VIR_DOMAIN_START_AUTODESTROY) != 0,
- -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE) < 0) {
+ if (qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ start_flags) < 0) {
virDomainAuditStart(vm, "booted", false);
if (qemuDomainObjEndJob(driver, vm) > 0)
qemuDomainRemoveInactive(driver, vm);
@@ -4138,9 +4143,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
}
/* Set the migration source and start it up. */
- ret = qemuProcessStart(conn, driver, vm, "stdio", false, true,
- false, *fd, path, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
+ ret = qemuProcessStart(conn, driver, vm, "stdio", *fd, path, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
+ VIR_QEMU_PROCESS_START_PAUSED);
if (intermediatefd != -1) {
if (ret < 0) {
@@ -4710,6 +4715,10 @@ qemuDomainObjStart(virConnectPtr conn,
bool autodestroy = (flags & VIR_DOMAIN_START_AUTODESTROY) != 0;
bool bypass_cache = (flags & VIR_DOMAIN_START_BYPASS_CACHE) != 0;
bool force_boot = (flags & VIR_DOMAIN_START_FORCE_BOOT) != 0;
+ unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD;
+
+ start_flags |= start_paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
+ start_flags |= autodestroy ? VIR_QEMU_PROCESS_START_AUTODESROY : 0;
/*
* If there is a managed saved state restore it instead of starting
@@ -4741,9 +4750,8 @@ qemuDomainObjStart(virConnectPtr conn,
}
}
- ret = qemuProcessStart(conn, driver, vm, NULL, true, start_paused,
- autodestroy, -1, NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ ret = qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags);
virDomainAuditStart(vm, "booted", ret >= 0);
if (ret >= 0) {
virDomainEventPtr event =
@@ -11027,9 +11035,10 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (config)
virDomainObjAssignDef(vm, config, false);
- rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
- false, true, false, -1, NULL, snap,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ rc = qemuProcessStart(snapshot->domain->conn,
+ driver, vm, NULL, -1, NULL, snap,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ VIR_QEMU_PROCESS_START_PAUSED);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
event = virDomainEventNewFromObj(vm,
@@ -11114,12 +11123,16 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
/* Flush first event, now do transition 2 or 3 */
bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0;
+ unsigned int start_flags = 0;
+
+ start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
if (event)
qemuDomainEventQueue(driver, event);
- rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
- false, paused, false, -1, NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ rc = qemuProcessStart(snapshot->domain->conn,
+ driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ start_flags);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
if (rc < 0) {
if (!vm->persistent) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dc4d616..fc83805 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1303,9 +1303,10 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
/* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom
*/
- if (qemuProcessStart(dconn, driver, vm, migrateFrom, false, true,
- true, dataFD[0], NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) {
+ if (qemuProcessStart(dconn, driver, vm, migrateFrom, dataFD[0], NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START,
+ VIR_QEMU_PROCESS_START_PAUSED |
+ VIR_QEMU_PROCESS_START_AUTODESROY) < 0) {
virDomainAuditStart(vm, "migrated", false);
/* Note that we don't set an error here because qemuProcessStart
* should have already done that.
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 692fc32..ecbf039 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3271,13 +3271,11 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
- bool cold_boot,
- bool start_paused,
- bool autodestroy,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop)
+ enum virNetDevVPortProfileOp vmop,
+ unsigned int flags)
{
int ret;
off_t pos = -1;
@@ -3290,6 +3288,12 @@ int qemuProcessStart(virConnectPtr conn,
unsigned long cur_balloon;
int i;
+ /* Okay, these are just internal flags,
+ * but doesn't hurt to check */
+ virCheckFlags(VIR_QEMU_PROCESS_START_COLD |
+ VIR_QEMU_PROCESS_START_PAUSED |
+ VIR_QEMU_PROCESS_START_AUTODESROY, -1);
+
hookData.conn = conn;
hookData.vm = vm;
hookData.driver = driver;
@@ -3434,7 +3438,8 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Checking for CDROM and floppy presence");
- if (qemuDomainCheckDiskPresence(driver, vm, cold_boot) < 0)
+ if (qemuDomainCheckDiskPresence(driver, vm,
+ flags & VIR_QEMU_PROCESS_START_COLD) < 0)
goto cleanup;
VIR_DEBUG("Setting up domain cgroup (if required)");
@@ -3633,7 +3638,7 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Handshake complete, child running");
if (migrateFrom)
- start_paused = true;
+ flags |= VIR_QEMU_PROCESS_START_PAUSED;
if (ret == -1) /* The VM failed to start; tear filters before taps */
virDomainConfVMNWFilterTeardown(vm);
@@ -3708,7 +3713,7 @@ int qemuProcessStart(virConnectPtr conn,
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (!start_paused) {
+ if (!(flags & VIR_QEMU_PROCESS_START_PAUSED)) {
VIR_DEBUG("Starting domain CPUs");
/* Allow the CPUS to start executing */
if (qemuProcessStartCPUs(driver, vm, conn,
@@ -3726,7 +3731,7 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DOMAIN_PAUSED_USER);
}
- if (autodestroy &&
+ if (flags & VIR_QEMU_PROCESS_START_AUTODESROY &&
qemuProcessAutoDestroyAdd(driver, vm, conn) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 5cb5ffc..2d75b005 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -44,17 +44,21 @@ void qemuProcessReconnectAll(virConnectPtr conn, struct qemud_driver *driver);
int qemuProcessAssignPCIAddresses(virDomainDefPtr def);
+typedef enum {
+ VIR_QEMU_PROCESS_START_COLD = 1 << 0,
+ VIR_QEMU_PROCESS_START_PAUSED = 1 << 1,
+ VIR_QEMU_PROCESS_START_AUTODESROY = 1 << 2,
+} qemuProcessStartFlags;
+
int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
- bool cold_boot,
- bool start_paused,
- bool autodestroy,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop);
+ enum virNetDevVPortProfileOp vmop,
+ unsigned int flags);
void qemuProcessStop(struct qemud_driver *driver,
virDomainObjPtr vm,
--
1.7.8.5
12 years, 7 months
[libvirt] [libvirt-test-API PATCH 0/2] Documentation update
by Martin Kletzander
I updated part of the documentation that was changed in last few
weeks. Screenshot test was updated again a little bit to suit the
needs of a documentation and replaced the source codes of previous two
tests mentioned in the documentation as it describe just what is
needed and has no overhead on the reader.
I'm not sure how the numbering goes in this case, but it can be
updated later or I can send a v2 in case it needs to be fixed right
away.
Martin Kletzander (2):
domain:screenshot: fixes and cleanup
Documentation: Update to current information
.../en-US/Understanding_libvirt-test-API.xml | 6 -
.../en-US/Using_libvirt-test-API.xml | 26 +-
.../en-US/Writing_a_test_case.xml | 325 ++++++++------------
.../libvirt-test-API_Guide/en-US/extras/log.txt | 53 ++--
repos/domain/screenshot.py | 45 ++-
5 files changed, 199 insertions(+), 256 deletions(-)
--
1.7.8.5
12 years, 7 months
[libvirt] [PATCH] docs: fix path to openvz network configuration file
by Guido Günther
It's vznet.conf not vznetctl.conf, see e.g.:
http://git.openvz.org/?p=vzctl;a=blob;f=bin/vznetcfg.in;h=e91f5c4a0744c1e...
---
docs/drvopenvz.html.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/drvopenvz.html.in b/docs/drvopenvz.html.in
index bb437d3..a8f9f28 100644
--- a/docs/drvopenvz.html.in
+++ b/docs/drvopenvz.html.in
@@ -67,7 +67,7 @@ openvz+ssh://root@example.com/system (remote access, SSH tunnelled)
script must be created manually by the host OS administrator. The
simplest way is to just download the latest version of this script
from a newer OpenVZ release, or upstream source repository. Then
- a generic configuration file <code>/etc/vz/vznetctl.conf</code>
+ a generic configuration file <code>/etc/vz/vznet.conf</code>
must be created containing
</p>
--
1.7.10
12 years, 7 months
[libvirt] [PATCH RESEND] qemuProcessStart: Switch to flags instead of bunch booleans
by Michal Privoznik
Currently, we have 3 boolean arguments we have to pass
to qemuProcessStart(). As libvirt grows it is harder and harder
to remember them and their position. Therefore we should
switch to flags instead.
---
This is just rebased version of:
http://www.redhat.com/archives/libvir-list/2012-March/msg00331.html
src/qemu/qemu_driver.c | 45 +++++++++++++++++++++++++++++----------------
src/qemu/qemu_migration.c | 7 ++++---
src/qemu/qemu_process.c | 21 +++++++++++++--------
src/qemu/qemu_process.h | 12 ++++++++----
4 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 65ed290..436ef37 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1351,10 +1351,16 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
virDomainPtr dom = NULL;
virDomainEventPtr event = NULL;
virDomainEventPtr event2 = NULL;
+ unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD;
virCheckFlags(VIR_DOMAIN_START_PAUSED |
VIR_DOMAIN_START_AUTODESTROY, NULL);
+ if (flags & VIR_DOMAIN_START_PAUSED)
+ start_flags |= VIR_QEMU_PROCESS_START_PAUSED;
+ if (flags & VIR_DOMAIN_START_AUTODESTROY)
+ start_flags |= VIR_QEMU_PROCESS_START_AUTODESROY;
+
qemuDriverLock(driver);
if (!(def = virDomainDefParseString(driver->caps, xml,
QEMU_EXPECTED_VIRT_TYPES,
@@ -1383,10 +1389,9 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup; /* XXXX free the 'vm' we created ? */
- if (qemuProcessStart(conn, driver, vm, NULL, true,
- (flags & VIR_DOMAIN_START_PAUSED) != 0,
- (flags & VIR_DOMAIN_START_AUTODESTROY) != 0,
- -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE) < 0) {
+ if (qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ start_flags) < 0) {
virDomainAuditStart(vm, "booted", false);
if (qemuDomainObjEndJob(driver, vm) > 0)
qemuDomainRemoveInactive(driver, vm);
@@ -4138,9 +4143,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
}
/* Set the migration source and start it up. */
- ret = qemuProcessStart(conn, driver, vm, "stdio", false, true,
- false, *fd, path, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_RESTORE);
+ ret = qemuProcessStart(conn, driver, vm, "stdio", *fd, path, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
+ VIR_QEMU_PROCESS_START_PAUSED);
if (intermediatefd != -1) {
if (ret < 0) {
@@ -4710,6 +4715,10 @@ qemuDomainObjStart(virConnectPtr conn,
bool autodestroy = (flags & VIR_DOMAIN_START_AUTODESTROY) != 0;
bool bypass_cache = (flags & VIR_DOMAIN_START_BYPASS_CACHE) != 0;
bool force_boot = (flags & VIR_DOMAIN_START_FORCE_BOOT) != 0;
+ unsigned int start_flags = VIR_QEMU_PROCESS_START_COLD;
+
+ start_flags |= start_paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
+ start_flags |= autodestroy ? VIR_QEMU_PROCESS_START_AUTODESROY : 0;
/*
* If there is a managed saved state restore it instead of starting
@@ -4741,9 +4750,8 @@ qemuDomainObjStart(virConnectPtr conn,
}
}
- ret = qemuProcessStart(conn, driver, vm, NULL, true, start_paused,
- autodestroy, -1, NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ ret = qemuProcessStart(conn, driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags);
virDomainAuditStart(vm, "booted", ret >= 0);
if (ret >= 0) {
virDomainEventPtr event =
@@ -11027,9 +11035,10 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
if (config)
virDomainObjAssignDef(vm, config, false);
- rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
- false, true, false, -1, NULL, snap,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ rc = qemuProcessStart(snapshot->domain->conn,
+ driver, vm, NULL, -1, NULL, snap,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ VIR_QEMU_PROCESS_START_PAUSED);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
detail = VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT;
event = virDomainEventNewFromObj(vm,
@@ -11114,12 +11123,16 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
/* Flush first event, now do transition 2 or 3 */
bool paused = (flags & VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED) != 0;
+ unsigned int start_flags = 0;
+
+ start_flags |= paused ? VIR_QEMU_PROCESS_START_PAUSED : 0;
if (event)
qemuDomainEventQueue(driver, event);
- rc = qemuProcessStart(snapshot->domain->conn, driver, vm, NULL,
- false, paused, false, -1, NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_CREATE);
+ rc = qemuProcessStart(snapshot->domain->conn,
+ driver, vm, NULL, -1, NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ start_flags);
virDomainAuditStart(vm, "from-snapshot", rc >= 0);
if (rc < 0) {
if (!vm->persistent) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dc4d616..fc83805 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1303,9 +1303,10 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
/* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom
*/
- if (qemuProcessStart(dconn, driver, vm, migrateFrom, false, true,
- true, dataFD[0], NULL, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START) < 0) {
+ if (qemuProcessStart(dconn, driver, vm, migrateFrom, dataFD[0], NULL, NULL,
+ VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_START,
+ VIR_QEMU_PROCESS_START_PAUSED |
+ VIR_QEMU_PROCESS_START_AUTODESROY) < 0) {
virDomainAuditStart(vm, "migrated", false);
/* Note that we don't set an error here because qemuProcessStart
* should have already done that.
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 692fc32..d18d721 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3271,13 +3271,11 @@ int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
- bool cold_boot,
- bool start_paused,
- bool autodestroy,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop)
+ enum virNetDevVPortProfileOp vmop,
+ unsigned int flags)
{
int ret;
off_t pos = -1;
@@ -3290,6 +3288,12 @@ int qemuProcessStart(virConnectPtr conn,
unsigned long cur_balloon;
int i;
+ /* Okay, these are just internal flags,
+ * but doesn't hurt to check */
+ virCheckFlags(VIR_QEMU_PROCESS_START_COLD |
+ VIR_QEMU_PROCESS_START_PAUSED |
+ VIR_QEMU_PROCESS_START_AUTODESROY, -1);
+
hookData.conn = conn;
hookData.vm = vm;
hookData.driver = driver;
@@ -3434,7 +3438,8 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
VIR_DEBUG("Checking for CDROM and floppy presence");
- if (qemuDomainCheckDiskPresence(driver, vm, cold_boot) < 0)
+ if (qemuDomainCheckDiskPresence(driver, vm,
+ flags & VIR_QEMU_PROCESS_START_COLD) < 0)
goto cleanup;
VIR_DEBUG("Setting up domain cgroup (if required)");
@@ -3633,7 +3638,7 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Handshake complete, child running");
if (migrateFrom)
- start_paused = true;
+ flags |= VIR_QEMU_PROCESS_START_PAUSED;
if (ret == -1) /* The VM failed to start; tear filters before taps */
virDomainConfVMNWFilterTeardown(vm);
@@ -3708,7 +3713,7 @@ int qemuProcessStart(virConnectPtr conn,
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
- if (!start_paused) {
+ if (flags & ~VIR_QEMU_PROCESS_START_PAUSED) {
VIR_DEBUG("Starting domain CPUs");
/* Allow the CPUS to start executing */
if (qemuProcessStartCPUs(driver, vm, conn,
@@ -3726,7 +3731,7 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DOMAIN_PAUSED_USER);
}
- if (autodestroy &&
+ if (flags & VIR_QEMU_PROCESS_START_AUTODESROY &&
qemuProcessAutoDestroyAdd(driver, vm, conn) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 5cb5ffc..2d75b005 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -44,17 +44,21 @@ void qemuProcessReconnectAll(virConnectPtr conn, struct qemud_driver *driver);
int qemuProcessAssignPCIAddresses(virDomainDefPtr def);
+typedef enum {
+ VIR_QEMU_PROCESS_START_COLD = 1 << 0,
+ VIR_QEMU_PROCESS_START_PAUSED = 1 << 1,
+ VIR_QEMU_PROCESS_START_AUTODESROY = 1 << 2,
+} qemuProcessStartFlags;
+
int qemuProcessStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom,
- bool cold_boot,
- bool start_paused,
- bool autodestroy,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop);
+ enum virNetDevVPortProfileOp vmop,
+ unsigned int flags);
void qemuProcessStop(struct qemud_driver *driver,
virDomainObjPtr vm,
--
1.7.8.5
12 years, 7 months
[libvirt] [PATCH] storage: lvm: use correct lv* command parameters
by Cole Robinson
lvcreate want's the parent pool's name, not the pool path
lvchange and lvremove want lv specified as $vgname/$lvname
This largely worked before because these commands strip off a
starting /dev. But https://bugzilla.redhat.com/show_bug.cgi?id=714986
is from a user using a 'nested VG' that was having problems.
I couldn't find any info on nested LVM and the reporter never responded,
but I reproduced with XML that specified a valid source name, and
set target path to a symlink.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/storage/storage_backend_logical.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 6a235f6..9a91dd9 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -672,7 +672,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
char size[100];
const char *cmdargvnew[] = {
LVCREATE, "--name", vol->name, "-L", size,
- pool->def->target.path, NULL
+ pool->def->source.name, NULL
};
const char *cmdargvsnap[] = {
LVCREATE, "--name", vol->name, "-L", size,
@@ -778,23 +778,23 @@ virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned int flags)
{
int ret = -1;
+ char *volpath = NULL;
virCommandPtr lvchange_cmd = NULL;
virCommandPtr lvremove_cmd = NULL;
virCheckFlags(0, -1);
- virFileWaitForDevices();
+ if (virAsprintf(&volpath, "%s/%s",
+ pool->def->source.name, vol->name) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
- lvchange_cmd = virCommandNewArgList(LVCHANGE,
- "-aln",
- vol->target.path,
- NULL);
+ virFileWaitForDevices();
- lvremove_cmd = virCommandNewArgList(LVREMOVE,
- "-f",
- vol->target.path,
- NULL);
+ lvchange_cmd = virCommandNewArgList(LVCHANGE, "-aln", volpath, NULL);
+ lvremove_cmd = virCommandNewArgList(LVREMOVE, "-f", volpath, NULL);
if (virCommandRun(lvremove_cmd, NULL) < 0) {
if (virCommandRun(lvchange_cmd, NULL) < 0) {
@@ -807,6 +807,7 @@ virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
ret = 0;
cleanup:
+ VIR_FREE(volpath);
virCommandFree(lvchange_cmd);
virCommandFree(lvremove_cmd);
return ret;
--
1.7.7.6
12 years, 7 months